aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-if-conv.c
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2020-08-07 10:16:05 +0200
committerRichard Biener <rguenther@suse.de>2020-08-07 12:21:36 +0200
commitc3f94f5786a014515c09c7852db228c74adf51e5 (patch)
tree1d201656f41289ed50030c457548b50f2d94449a /gcc/tree-if-conv.c
parente87c540fe43e29663140ed67b98ee437c25696bb (diff)
downloadgcc-c3f94f5786a014515c09c7852db228c74adf51e5.zip
gcc-c3f94f5786a014515c09c7852db228c74adf51e5.tar.gz
gcc-c3f94f5786a014515c09c7852db228c74adf51e5.tar.bz2
tree-optimization/96514 - avoid if-converting control-altering calls
This avoids if-converting when encountering control-altering calls. 2020-08-07 Richard Biener <rguenther@suse.de> PR tree-optimization/96514 * tree-if-conv.c (if_convertible_bb_p): If the last stmt is a call that is control-altering, fail. * gcc.dg/pr96514.c: New testcase.
Diffstat (limited to 'gcc/tree-if-conv.c')
-rw-r--r--gcc/tree-if-conv.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/gcc/tree-if-conv.c b/gcc/tree-if-conv.c
index fc894eb..257759d 100644
--- a/gcc/tree-if-conv.c
+++ b/gcc/tree-if-conv.c
@@ -1139,6 +1139,11 @@ if_convertible_bb_p (class loop *loop, basic_block bb, basic_block exit_bb)
if (EDGE_COUNT (bb->succs) > 2)
return false;
+ gimple *last = last_stmt (bb);
+ if (gcall *call = safe_dyn_cast <gcall *> (last))
+ if (gimple_call_ctrl_altering_p (call))
+ return false;
+
if (exit_bb)
{
if (bb != loop->latch)