aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2022-01-12 08:10:19 +0100
committerRichard Biener <rguenther@suse.de>2022-01-12 08:11:31 +0100
commit45ddb395187f8f5f278880fe1422d8958ac35da6 (patch)
tree5503f03b251393abaa958eb87034aa266dac9920 /gcc
parent31aa664add55542e8e561cd599aa6a2a4e683d73 (diff)
downloadgcc-45ddb395187f8f5f278880fe1422d8958ac35da6.zip
gcc-45ddb395187f8f5f278880fe1422d8958ac35da6.tar.gz
gcc-45ddb395187f8f5f278880fe1422d8958ac35da6.tar.bz2
tree-optimization/76174 - testcase for fixed PR
This adds a testcase for the fixed PR, VN now gets us the transform via IV equality plus predication. 2022-01-12 Richard Biener <rguenther@suse.de> PR tree-optimization/76174 * gcc.dg/tree-ssa/pr76174.c: New testcase.
Diffstat (limited to 'gcc')
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/pr76174.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr76174.c b/gcc/testsuite/gcc.dg/tree-ssa/pr76174.c
new file mode 100644
index 0000000..17a4a0f
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr76174.c
@@ -0,0 +1,22 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-cddce1" } */
+
+void foo();
+
+void l(unsigned int r) {
+ unsigned int q = 0;
+ unsigned int c = r;
+ for (unsigned int x = 0; x<r; x++) {
+ if (q == c) {
+ foo();
+ c *= 2;
+ }
+ q++;
+ }
+}
+
+/* We should be able to elide the body of the function by means of
+ figuring out the equality between the two IVs and then simplifying
+ the q == c test. */
+/* { dg-final { scan-tree-dump-not "foo" "cddce1" } } */
+/* { dg-final { scan-tree-dump-times "bb" 1 "cddce1" } } */