aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2016-08-09 07:40:50 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2016-08-09 07:40:50 +0000
commit50bf47fdc08807bf8fc0362d677c8fc7dd4514b0 (patch)
tree2bb2c9f41ad63b81575fdbde736acc6db6257acc /gcc
parentfe7afdf5b55d1c3b8b00e7ea16b1b5df0537f45a (diff)
downloadgcc-50bf47fdc08807bf8fc0362d677c8fc7dd4514b0.zip
gcc-50bf47fdc08807bf8fc0362d677c8fc7dd4514b0.tar.gz
gcc-50bf47fdc08807bf8fc0362d677c8fc7dd4514b0.tar.bz2
re PR tree-optimization/71802 (gcc ICE at -O3 on valid code on x86_64-linux-gnu in expand_LOOP_VECTORIZED)
2016-08-09 Richard Biener <rguenther@suse.de> PR tree-optimization/71802 * tree-cfgcleanup.c (cleanup_tree_cfg_bb): Make sure to catch all merge opportunities with the predecessor. * gcc.dg/torture/pr71802.c: New testcase. From-SVN: r239274
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gcc.dg/torture/pr71802.c37
-rw-r--r--gcc/tree-cfgcleanup.c29
4 files changed, 63 insertions, 14 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index eb0dc1d..2d96f88 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,11 @@
2016-08-09 Richard Biener <rguenther@suse.de>
+ PR tree-optimization/71802
+ * tree-cfgcleanup.c (cleanup_tree_cfg_bb): Make sure to catch
+ all merge opportunities with the predecessor.
+
+2016-08-09 Richard Biener <rguenther@suse.de>
+
PR ipa/68273
* ipa-prop.c (ipa_modify_formal_parameters): Build
parameter types with natural alignment also for the
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index f560fe4..9ba1052 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2016-08-09 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/71802
+ * gcc.dg/torture/pr71802.c: New testcase.
+
2016-08-09 Jakub Jelinek <jakub@redhat.com>
PR c++/72809
diff --git a/gcc/testsuite/gcc.dg/torture/pr71802.c b/gcc/testsuite/gcc.dg/torture/pr71802.c
new file mode 100644
index 0000000..0dd1467
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr71802.c
@@ -0,0 +1,37 @@
+/* { dg-do compile } */
+
+int b, c;
+long d, f;
+void fn1()
+{
+ char g;
+ long long h = 0;
+ int *i;
+ if (0) {
+L2:
+ b && (b = f);
+ d = 3;
+ for (; d;) {
+ char *j = &g;
+ c = *j = 0;
+L3:
+ *j %= b;
+ for (; g <= 4;)
+ ;
+ }
+ goto L2;
+ }
+ for (; *i; *i = 1) {
+ if ((h -= 4) == (h != (b ?: d))) {
+ g = 3;
+ goto L3;
+ }
+ i = (int *)&h;
+ *i = f;
+ i = (int *)&f;
+ if ((h && 6) - (h = 0))
+ goto L2;
+ }
+ for (; d;)
+ goto L3;
+}
diff --git a/gcc/tree-cfgcleanup.c b/gcc/tree-cfgcleanup.c
index ab8a913..3fe0d3e 100644
--- a/gcc/tree-cfgcleanup.c
+++ b/gcc/tree-cfgcleanup.c
@@ -641,24 +641,25 @@ cleanup_tree_cfg_bb (basic_block bb)
&& remove_forwarder_block (bb))
return true;
+ /* If there is a merge opportunity with the predecessor
+ do nothing now but wait until we process the predecessor.
+ This happens when we visit BBs in a non-optimal order and
+ avoids quadratic behavior with adjusting stmts BB pointer. */
+ if (single_pred_p (bb)
+ && can_merge_blocks_p (single_pred (bb), bb))
+ /* But make sure we _do_ visit it. When we remove unreachable paths
+ ending in a backedge we fail to mark the destinations predecessors
+ as changed. */
+ bitmap_set_bit (cfgcleanup_altered_bbs, single_pred (bb)->index);
+
/* Merging the blocks may create new opportunities for folding
conditional branches (due to the elimination of single-valued PHI
nodes). */
- if (single_succ_p (bb)
- && can_merge_blocks_p (bb, single_succ (bb)))
+ else if (single_succ_p (bb)
+ && can_merge_blocks_p (bb, single_succ (bb)))
{
- /* If there is a merge opportunity with the predecessor
- do nothing now but wait until we process the predecessor.
- This happens when we visit BBs in a non-optimal order and
- avoids quadratic behavior with adjusting stmts BB pointer. */
- if (single_pred_p (bb)
- && can_merge_blocks_p (single_pred (bb), bb))
- ;
- else
- {
- merge_blocks (bb, single_succ (bb));
- return true;
- }
+ merge_blocks (bb, single_succ (bb));
+ return true;
}
return false;