On Wed, Jan 23, 2019 at 09:23:53AM +0100, Richard Biener wrote:
> On Tue, 22 Jan 2019, Jakub Jelinek wrote:
> 
> > Hi!
> > 
> > SCEV can analyze not just integral/pointer IVs, but (scalar) float ones as
> > well.  Calling build_int_cst on such types results in ICE, build_zero_cst
> > works.  Though the loop invariant PHI IVs, if we represent them as using
> > +0.0 step, aren't correct if honoring signed zeros, as + 0.0 will make
> > a +0.0 out of -0.0.
> > 
> > Bootstrapped/regtested on {x86_64,i686,powerpc64{,le}}-linux, ok for trunk?
> 
> OK.

Thinking about it, if we honor SNaNs, we should punt too, even if we are not
honoring signed zeros, because sNaN + 0.0 artificially added there will
raise an exception, where previously the code could not raise it.

Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux, ok for
trunk?

2019-01-24  Jakub Jelinek  <ja...@redhat.com>

        PR tree-optimization/88964
        * gimple-loop-interchange.cc (loop_cand::analyze_induction_var): Also
        punt if HONOR_SNANS (chrec).

--- gcc/gimple-loop-interchange.cc.jj   2019-01-23 09:34:53.739433699 +0100
+++ gcc/gimple-loop-interchange.cc      2019-01-23 12:53:35.215848790 +0100
@@ -690,8 +690,8 @@ loop_cand::analyze_induction_var (tree v
     {
       /* Punt on floating point invariants if honoring signed zeros,
         representing that as + 0.0 would change the result if init
-        is -0.0.  */
-      if (HONOR_SIGNED_ZEROS (chrec))
+        is -0.0.  Similarly for SNaNs it can raise exception.  */
+      if (HONOR_SIGNED_ZEROS (chrec) || HONOR_SNANS (chrec))
        return false;
       struct induction *iv = XCNEW (struct induction);
       iv->var = var;


        Jakub

Reply via email to