From cd83fd98a7e769ac7ded28377984f68238812a26 Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Mon, 3 Jan 2022 10:48:57 +0100 Subject: [PATCH] tree-optimization/66502 - add testcase This adds the second testcase which we now also handle eliminating a redundant PHI node. 2022-01-03 Richard Biener PR tree-optimization/66502 * gcc.dg/tree-ssa/ssa-fre-98.c: New testcase. --- gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-98.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-98.c diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-98.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-98.c new file mode 100644 index 0000000..3d28609 --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-98.c @@ -0,0 +1,18 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-fre1-details" } */ + +int foo (int a, int s, unsigned int k) +{ + int i = a, j = a; + do + { + i += s; + j += j; + j -= a; + } + while (k--); + return j+i; +} + +/* We want the redundant PHI for j to disappear. */ +/* { dg-final { scan-tree-dump "Replaced redundant PHI node defining j" "fre1" } } */ -- 2.7.4