This is the mail archive of the 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]

[RFA] Fix Ada bootstrap (was: 16: EH redirection)


in the course of retesting the SSA-expand patches I noticed that Ada 
doesn't bootstrap with an SSA verification error.  I think that's a 
fallout of the EH edge improvements, but haven't verified if backing them 
out would work-around it, as it's anyway a bug in SRA.

SRA in some cases (when the RHS is a bitfield ref) wants to use the 
gimplifier to decompose its complicated expressions into gimple 
statements.  It uses an into-ssa context for that, which mean every LHS 
will automatically get a new SSA name (if is_gimple_reg).

The generated sequence of gimple instructions then is possibly inserted 
into all outgoing edges of the current BB (that happens if there's memory 
accesses and trapping involved).  To copy the sequence (to insert them on 
possibly multiple edges) it uses gimple_copy_seq.  This one only 
deep-copies the instructions, including the SSA names.

Now, if those instructions then finally are inserted onto the edges we 
suddenly have multiple instructions defining the same SSA name --> boom.

The LHS sides of this are marked for renaming, but quite obviously the 
update_ssa code isn't prepared to deal with pre-existing SSA-name defining 
instructions which also are marked for renaming (at least if no old_ or 
new_ssa_names are involved).

So, instead of fiddling with update_ssa for this unusable case, I simply 
changed SRA to not use the into_ssa mode of the gimplifier, but instead to 
rely on usual update_ssa.  This requires also marking all generated 
temporaries (from the gimplifier) for renaming, and not just to mark them 
referenced.  Only SRA uses the gimplifier in that mode explicitely (apart 
from those uses abstracted away in force_gimple_operand and 

Without this patch r146781 doesn't even build with Ada on x86_64-linux.  
With the patch it builds.

I'm currently regstrapping on x86_64-linux.  Okay if it works?

	* tree-sra.c (sra_build_assignment): Don't use into_ssa mode,
	mark new temporaries for renaming.

Index: tree-sra.c
--- tree-sra.c	(Revision 146781)
+++ tree-sra.c	(Arbeitskopie)
@@ -2206,14 +2206,16 @@ sra_build_assignment (tree dst, tree src
 	var = fold_build1 (VIEW_CONVERT_EXPR, TREE_TYPE (dst), var);
       push_gimplify_context (&gctx);
-      gctx.into_ssa = true;
       gctx.allow_rhs_cond_expr = true;
       gimplify_assign (dst, var, &seq);
       if (gimple_referenced_vars (cfun))
 	for (var = gctx.temps; var; var = TREE_CHAIN (var))
-	  add_referenced_var (var);
+	  {
+	    add_referenced_var (var);
+	    mark_sym_for_renaming (var);
+	  }
       pop_gimplify_context (NULL);
       return seq;

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