re PR rtl-optimization/80491 (Compiler regression for long-add case.)
authorJakub Jelinek <jakub@redhat.com>
Sat, 29 Apr 2017 16:18:11 +0000 (18:18 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Sat, 29 Apr 2017 16:18:11 +0000 (18:18 +0200)
PR rtl-optimization/80491
* ifcvt.c (noce_process_if_block): When looking for x setter
with missing else_bb, don't check only the insn right before
cond_earliest, but look for the last insn that x is modified in
within the same bb.

From-SVN: r247410

gcc/ChangeLog
gcc/ifcvt.c

index 9a9d192d01a5f1972a0be78f8ed6e24500518523..bb380b325a642a5899eaede7e0b9efe51bc1b527 100644 (file)
@@ -1,5 +1,11 @@
 2017-04-29  Jakub Jelinek  <jakub@redhat.com>
 
+       PR rtl-optimization/80491
+       * ifcvt.c (noce_process_if_block): When looking for x setter
+       with missing else_bb, don't check only the insn right before
+       cond_earliest, but look for the last insn that x is modified in
+       within the same bb.
+
        PR rtl-optimization/80491
        * alias.c (memory_modified_in_insn_p): Return true for CALL_INSNs.
 
index e51ccab26b2984f8831f9af49ff77e53e05ec917..75458589468b50262eeb682e3224a94c92c3f8d3 100644 (file)
@@ -3440,7 +3440,14 @@ noce_process_if_block (struct noce_if_info *if_info)
     }
   else
     {
-      insn_b = prev_nonnote_nondebug_insn (if_info->cond_earliest);
+      insn_b = if_info->cond_earliest;
+      do
+       insn_b = prev_nonnote_nondebug_insn (insn_b);
+      while (insn_b
+            && (BLOCK_FOR_INSN (insn_b)
+                == BLOCK_FOR_INSN (if_info->cond_earliest))
+            && !modified_in_p (x, insn_b));
+
       /* We're going to be moving the evaluation of B down from above
         COND_EARLIEST to JUMP.  Make sure the relevant data is still
         intact.  */