tree-optimization/111003 - new testcase

Message ID 20240111075915.45BB13861821@sourceware.org
State Accepted
Headers
Series tree-optimization/111003 - new testcase |

Checks

Context Check Description
snail/gcc-patch-check success Github commit url

Commit Message

Richard Biener Jan. 11, 2024, 7:53 a.m. UTC
  Testcase for fixed PR.

Pushed.

	PR tree-optimization/111003
gcc/testsuite/
	* gcc.dg/tree-ssa/pr111003.c: New testcase.
---
 gcc/testsuite/gcc.dg/tree-ssa/pr111003.c | 34 ++++++++++++++++++++++++
 1 file changed, 34 insertions(+)
 create mode 100644 gcc/testsuite/gcc.dg/tree-ssa/pr111003.c
  

Patch

diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr111003.c b/gcc/testsuite/gcc.dg/tree-ssa/pr111003.c
new file mode 100644
index 00000000000..a520765dd9f
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr111003.c
@@ -0,0 +1,34 @@ 
+/* { dg-do compile } */
+/* { dg-options "-O3 -fdump-tree-optimized" } */
+
+static int c, d, e, f;
+static short g;
+static int *h = &c;
+void foo(void);
+short(a)();
+static unsigned b(unsigned char j, int l) { return j > l ? j : j << l; }
+static int *i();
+static void k(int j, unsigned char l) {
+  i();
+  g = f;
+  f = g;
+  for (; g;) {
+    int m = 0;
+    d = a();
+    for (; d;) {
+      if (l)
+        if (!(j >= -639457069 && j <= -639457069))
+          if (m)
+            foo(); // This call should be elided
+      m = !(10 != (l ^ b(j, 6))) & (0 > e);
+    }
+  }
+}
+static int *i() {
+  for (; e; e = a(e, 6))
+    ;
+  return h;
+}
+int main() { k(c, c); }
+
+/* { dg-final { scan-tree-dump-not "foo" "optimized" } } */