diff mbox series

[COMMITTED] PR tree-optimization/102648 - Add the testcase for this PR to the testsuite.

Message ID 003b078a-77c9-e8db-438d-2c48f178579b@redhat.com
State New
Headers show
Series [COMMITTED] PR tree-optimization/102648 - Add the testcase for this PR to the testsuite. | expand

Commit Message

Andrew MacLeod Nov. 25, 2021, 2:03 p.m. UTC
Various ranger enabled passes, such as threading, or VRP2 resolve this 
now.  I'm adding the test case before closing.

committed as obvious.

Andrew
diff mbox series

Patch

commit 1598bd47b2a4a5f12b5a987d16d82634644db4b6
Author: Andrew MacLeod <amacleod@redhat.com>
Date:   Thu Nov 25 08:58:19 2021 -0500

    Add the testcase for this PR to the testsuite.
    
    Various ranger-enabled patches like threading and VRP2 can do this now, so add the testcase for posterity.
    
            gcc/testsuite/
            PR tree-optimization/102648
            * gcc.dg/pr102648.c: New.

diff --git a/gcc/testsuite/gcc.dg/pr102648.c b/gcc/testsuite/gcc.dg/pr102648.c
new file mode 100644
index 00000000000..a0f6386dde3
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr102648.c
@@ -0,0 +1,21 @@ 
+/* { dg-do compile } */
+/* { dg-options "-O3 -fdump-tree-optimized" } */
+
+void foo();
+static char a, c;
+static int d, e;
+static short b(short f, short g) { return f * g; }
+int main() {
+  short h = 4;
+  for (; d;)
+    if (h)
+      if(e) {
+        if (!b(a & 1 | h, 3))
+          c = 0;
+        h = 1;
+      }
+  if (c)
+    foo();
+}
+
+/* { dg-final { scan-tree-dump-not "foo" "optimized" } } */