Hi,

PR89008 observes that SLSR gets confused when provided with an expression of 
the form X * 0.
The bug is currently latent on trunk, gcc 8, and gcc 7.  This patch avoids 
placing such
expressions in SLSR's candidate table, since they aren't of any use anyway.

Bootstrapped and tested on powerpc64le-unknown-linux-gnu with no regressions.  
Tested on
an older revision where the bug was observable and found to fix the problem.  
Committed,
backports pending.

Thanks,
Bill


2018-01-31  Bill Schmidt  <wschm...@linux.ibm.com>

        PR tree-optimization/89008
        * gimple-ssa-strength-reduction.c (slsr_process_mul): Don't
        process anything of the form X * 0.

Index: gcc/gimple-ssa-strength-reduction.c                                      
===================================================================
--- gcc/gimple-ssa-strength-reduction.c (revision 268411)                       
+++ gcc/gimple-ssa-strength-reduction.c (working copy)                          
@@ -1268,7 +1268,7 @@ slsr_process_mul (gimple *gs, tree rhs1, tree rhs2
       c->next_interp = c2->cand_num;                                           
       c2->first_interp = c->cand_num;                                          
     }                                                                          
-  else if (TREE_CODE (rhs2) == INTEGER_CST)                                    
+  else if (TREE_CODE (rhs2) == INTEGER_CST && !integer_zerop (rhs2))           
     {                                                                          
       /* Record an interpretation for the multiply-immediate.  */              
       c = create_mul_imm_cand (gs, rhs1, rhs2, speed);                         


Reply via email to