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.

Tested on x86_64-suse-linux, OK for the mainline?


2016-02-08  Eric Botcazou  <ebotca...@adacore.com>

        * gimple-ssa-backprop.c (optimize_phi): Do not replace an argument
        with SSA_NAME_OCCURS_IN_ABNORMAL_PHI set.

-- 
Eric Botcazou
Index: gimple-ssa-backprop.c
===================================================================
--- gimple-ssa-backprop.c	(revision 233194)
+++ gimple-ssa-backprop.c	(working copy)
@@ -840,13 +840,14 @@ backprop::optimize_phi (gphi *phi, tree
       bool replaced = false;
       FOR_EACH_PHI_ARG (use, phi, oi, SSA_OP_USE)
 	{
-	  tree new_arg = strip_sign_op (USE_FROM_PTR (use));
-	  if (new_arg)
+	  tree arg = USE_FROM_PTR (use);
+	  tree new_arg = strip_sign_op (arg);
+	  if (new_arg && !SSA_NAME_OCCURS_IN_ABNORMAL_PHI (arg))
 	    {
 	      if (!replaced)
 		prepare_change (var);
 	      if (dump_file && (dump_flags & TDF_DETAILS))
-		note_replacement (phi, USE_FROM_PTR (use), new_arg);
+		note_replacement (phi, arg, new_arg);
 	      replace_exp (use, new_arg);
 	      replaced = true;
 	    }

Reply via email to