This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch] Fix SSA_NAME_OCCURS_IN_ABNORMAL_PHI issue in backprop


On Mon, Feb 8, 2016 at 11:37 AM, Eric Botcazou <ebotcazou@adacore.com> wrote:
> Hi,
>
> the Ada runtime fails to build for platforms still using the old SJLJ scheme
> because of the new GIMPLE backprop pass (hence it's a regression):
>
> eric@polaris:~/build/gcc/native> gcc/gnat1 -quiet a-ncelfu.ads -gnatpg -O -I
> ~/svn/gcc/gcc/ada/
> a-ngcefu.adb: In function 'Ada.Numerics.Complex_Elementary_Functions.Sqrt':
> a-ngcefu.adb:16:4: error: SSA_NAME_OCCURS_IN_ABNORMAL_PHI should be set
> for SSA_NAME: _28 in statement:
> xr_3(ab) = PHI <xr_22(D)(ab)(2), xr_22(D)(ab)(3), xr_22(D)(ab)(4), _28(5),
> _28(6), _28(7), xr_4(ab)(11), xr_4(ab)(12), xr_4(ab)(14), xr_4(ab)(15),
> xr_4(ab)(16), xr_4(ab)(17), xr_4(ab)(18), xr_4(ab)(19), xr_4(ab)(20), xr_4(ab)
> (21), xr_4(ab)(22), xr_4(ab)(23), xr_4(ab)(24), xr_4(ab)(25), xr_4(ab)(26),
> xr_4(ab)(27), xr_4(ab)(28), xr_4(ab)(29), xr_4(ab)(30), xr_4(ab)(32), xr_4(ab)
> (34), xr_4(ab)(36), xr_4(ab)(37)>
> PHI argument
> _28
> for PHI node
> xr_3(ab) = PHI <xr_22(D)(ab)(2), xr_22(D)(ab)(3), xr_22(D)(ab)(4), _28(5),
> _28(6), _28(7), xr_4(ab)(11), xr_4(ab)(12), xr_4(ab)(14), xr_4(ab)(15),
> xr_4(ab)(16), xr_4(ab)(17), xr_4(ab)(18), xr_4(ab)(19), xr_4(ab)(20), xr_4(ab)
> (21), xr_4(ab)(22), xr_4(ab)(23), xr_4(ab)(24), xr_4(ab)(25), xr_4(ab)(26),
> xr_4(ab)(27), xr_4(ab)(28), xr_4(ab)(29), xr_4(ab)(30), xr_4(ab)(32), xr_4(ab)
> (34), xr_4(ab)(36), xr_4(ab)(37)>
> +===========================GNAT BUG DETECTED==============================+
> | 6.0.0 20160206 (experimental) [trunk revision 233194] (x86_64-suse-linux)
> GCC error:|
> | verify_ssa failed                                                        |
> | Error detected around a-ngcefu.adb:16:4
>
> The problem is that the pass propagates the source RHS (_28) of:
>
>   xr_29(ab) = ABS_EXPR <_28>;
>
> into a PHI note using xr_29 along an AB edge so the above check triggers.
>
> I think replacing such an AB SSA_NAME is problematic in any case: if the RHS
> is not AB, then the check triggers; if the RHS is also AB, then we may create
> overlapping live ranges and the compilation will abort later.  We can probably
> create a new SSA_NAME but it's not really the spirit of the backprop pass and
> I'm not sure it's worth the hassle, hence the minimal attached fixlet.

I think the problematic transform is when the replacement happens on a PHI arg
with its edge being abnormal only.  Thus simply do

  if (EDGE_PRED (gimple_bb (phi), PHI_ARG_INDEX_FROM_USE (use))->flags
& EDGE_ABNORMAL)
   continue;

at the start of the FOR_EACH_PHI_ARG body.

Thanks,
Richard.

> Tested on x86_64-suse-linux, OK for the mainline?
>
>
> 2016-02-08  Eric Botcazou  <ebotcazou@adacore.com>
>
>         * gimple-ssa-backprop.c (optimize_phi): Do not replace an argument
>         with SSA_NAME_OCCURS_IN_ABNORMAL_PHI set.
>
> --
> Eric Botcazou


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]