diff mbox series

[committed] Fix SLSR portion of PR89008

Message ID 67bd1180-5dc0-0ed2-9e94-8c67a61d0159@linux.ibm.com
State New
Headers show
Series [committed] Fix SLSR portion of PR89008 | expand

Commit Message

Bill Schmidt Jan. 31, 2019, 2:45 p.m. UTC
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  <wschmidt@linux.ibm.com>

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

Patch

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);