aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-loop-im.c
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2020-05-25 10:09:44 +0200
committerRichard Biener <rguenther@suse.de>2020-05-25 13:39:26 +0200
commit4acca1c0635dfa43cd8c4bfe2b22e17909fc23a3 (patch)
tree74b0f5c61cae3185360a3aeb84c50605cd09f46c /gcc/tree-ssa-loop-im.c
parentc0e27f72358794692e367363940c6383e9ad1e45 (diff)
downloadgcc-4acca1c0635dfa43cd8c4bfe2b22e17909fc23a3.zip
gcc-4acca1c0635dfa43cd8c4bfe2b22e17909fc23a3.tar.gz
gcc-4acca1c0635dfa43cd8c4bfe2b22e17909fc23a3.tar.bz2
tree-optimization/95295 - fix wrong-code with SM
We failed to compare the rematerialized store values when merging paths after walking PHIs. 2020-05-25 Richard Biener <rguenther@suse.de> PR tree-optimization/95295 * tree-ssa-loop-im.c (sm_seq_valid_bb): Compare remat stores RHSes and drop to full sm_other if they are not equal. * gcc.dg/torture/pr95295-1.c: New testcase. * gcc.dg/torture/pr95295-2.c: Likewise. * gcc.dg/torture/pr95283.c: Likewise.
Diffstat (limited to 'gcc/tree-ssa-loop-im.c')
-rw-r--r--gcc/tree-ssa-loop-im.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/gcc/tree-ssa-loop-im.c b/gcc/tree-ssa-loop-im.c
index fcca099..b399bd0 100644
--- a/gcc/tree-ssa-loop-im.c
+++ b/gcc/tree-ssa-loop-im.c
@@ -2402,6 +2402,7 @@ sm_seq_valid_bb (class loop *loop, basic_block bb, tree vdef,
if (edge_seq[i].second == sm_ord)
bitmap_set_bit (refs_not_supported, edge_seq[i].first);
first_edge_seq[i].second = sm_other;
+ first_edge_seq[i].from = NULL_TREE;
}
/* sm_other prevails. */
else if (first_edge_seq[i].second != edge_seq[i].second)
@@ -2410,7 +2411,14 @@ sm_seq_valid_bb (class loop *loop, basic_block bb, tree vdef,
gcc_assert (bitmap_bit_p (refs_not_supported,
first_edge_seq[i].first));
first_edge_seq[i].second = sm_other;
+ first_edge_seq[i].from = NULL_TREE;
}
+ else if (first_edge_seq[i].second == sm_other
+ && first_edge_seq[i].from != NULL_TREE
+ && (edge_seq[i].from == NULL_TREE
+ || !operand_equal_p (first_edge_seq[i].from,
+ edge_seq[i].from, 0)))
+ first_edge_seq[i].from = NULL_TREE;
}
/* Any excess elements become sm_other since they are now
coonditionally executed. */