From 980af7e02e2f824385a01dea0b053074a70c1645 Mon Sep 17 00:00:00 2001 From: rguenth Date: Wed, 11 Apr 2012 08:13:37 +0000 Subject: 2012-04-11 Richard Guenther 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 --- gcc/ifcvt.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'gcc/ifcvt.c') 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. -- cgit v1.2.1