summaryrefslogtreecommitdiff
path: root/gcc/ifcvt.c
diff options
context:
space:
mode:
authorrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2012-04-11 08:13:37 +0000
committerrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2012-04-11 08:13:37 +0000
commit980af7e02e2f824385a01dea0b053074a70c1645 (patch)
tree9889ff32a80ab00280cbd8d5df9c0803fe1cbbfa /gcc/ifcvt.c
parentd906930c6fa60fb83b74a95d9cc30ff6aa089ab1 (diff)
downloadgcc-980af7e02e2f824385a01dea0b053074a70c1645.tar.gz
2012-04-11 Richard Guenther <rguenther@suse.de>
PR rtl-optimization/52881 * ifcvt.c (find_if_case_2): Avoid speculating loop latches. * gcc.dg/torture/pr52881.c: New testcase. * gcc.dg/torture/pr52913.c: Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@186304 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ifcvt.c')
-rw-r--r--gcc/ifcvt.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/gcc/ifcvt.c b/gcc/ifcvt.c
index e4e13abe0aa..79e27380283 100644
--- a/gcc/ifcvt.c
+++ b/gcc/ifcvt.c
@@ -3927,6 +3927,11 @@ find_if_case_2 (basic_block test_bb, edge then_edge, edge else_edge)
edge else_succ;
int then_prob, else_prob;
+ /* We do not want to speculate (empty) loop latches. */
+ if (current_loops
+ && else_bb->loop_father->latch == else_bb)
+ return FALSE;
+
/* If we are partitioning hot/cold basic blocks, we don't want to
mess up unconditional or indirect jumps that cross between hot
and cold sections.