aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/testsuite/gcc.dg/pr96514.c27
-rw-r--r--gcc/tree-if-conv.c5
2 files changed, 32 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/pr96514.c b/gcc/testsuite/gcc.dg/pr96514.c
new file mode 100644
index 0000000..891b4da
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr96514.c
@@ -0,0 +1,27 @@
+/* { dg-do compile } */
+
+int __attribute__ ((pure, returns_twice))
+r0 (void);
+
+void
+vy (int t7)
+{
+ while (t7 == 0)
+ r0 ();
+}
+
+void
+qw (int t7)
+{
+ vy (t7);
+
+ if (0)
+ r0 ();
+}
+
+void __attribute__ ((simd))
+un (int t7)
+{
+ qw (t7);
+ qw (t7);
+}
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)