[PATCH] Fix ICE in expand_cse_reciprocals (PR tree-optimization/42078)

Michael Matz matz@suse.de
Thu Nov 19 14:15:00 GMT 2009


Hi,

On Thu, 19 Nov 2009, Jakub Jelinek wrote:

> > Nope, you don't want to leave in the original a/sqrt(b) expression, it 
> > would result in slower code.  Hence you want to do that transformation 
> > only when you can replace all uses of the result, meaning that it's 
> > not necessary to preserve the old SSA name, at which point it's 
> > useless complexity to generate new instructions and a SSA name.
> 
> Please read the patch Alex said, it doesn't leave the original 
> expression in the IL, but by not doing ugly hacks (and reusing the same 
> SSA name for something completely different is an ugly hack) you get all 
> the needed debug info updates for free.  I like Alex' patch, it is much 
> nicer than what I posted.

It is nicer, yes.  But:

+                 rstmt1 = gimple_copy (stmt1);
+                 rarg1 = duplicate_ssa_name (arg1, rstmt1);
+                 gimple_call_set_lhs (rstmt1, rarg1);
+                 gimple_call_set_fndecl (rstmt1, fndecl);
+
+                 gsi1 = gsi_for_stmt (stmt1);
+                 gsi_insert_before (&gsi1, rstmt1, true);
+                 /* This will reset debug stmts that refer to arg1,
+                    so we don't have to check for them in the loop
+                    below.  */
+                 gsi_remove (&gsi1, true);

Instead of copying the statement, inserting it and removing the original, 
it should be possible to simply replace the LHS with a new SSA name (as 
well as the fndecl), shouldn't it?


Ciao,
Michael.



More information about the Gcc-patches mailing list