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 PR23109


On Thu, 28 Jul 2005, Richard Henderson wrote:

> On Thu, Jul 28, 2005 at 05:04:33PM +0200, Richard Guenther wrote:
> > 	* tree-ssa-loop-im.c (determine_invariantness_stmt): Honour
> > 	trapping math during hoisting 1/d.
> 
> This is ok.
> 
> > 	* tree-ssa-math-opts.c (gate_cse_reciprocals): Likewise.
> 
> I don't like this one.  It prevents
> 
> 	b = foo;
> 	z = a/b + c/b;
> 
> from being converted, even though everything is in the same basic block.

But

  z = a/b + c/b;

traps two times, while

  d = 1/b;
  z = a*d + b*d;

traps only one time.  Is this a valid transformation then?  I.e.
one could count the number of traps with a signal handler.  Also
I believe the C standard says that at the point of the trap results
of previous sequence points are comitted, so

  global = x;
  z = a/b + c/b;

to

  d = 1/b;
  global = x;
  z = a*d + c*d;

would be invalid, as at the trap point, the store to global is not
observable.  So we'd need to do even stricter checks?

I'll commit the loop-im change later today.

Thanks,
Richard.


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