https://gcc.gnu.org/g:4756557f5e3262f7f733f583bbbd69387fca8017

commit r16-1068-g4756557f5e3262f7f733f583bbbd69387fca8017
Author: Andrew Pinski <quic_apin...@quicinc.com>
Date:   Mon Jun 2 20:50:44 2025 -0700

    phiprop: Add testcase for already fixed case [PR116824]
    
    This testcase was fixed by r16-906-g8da568c885dc90. Since
    this is a C testcase, it would be useful to have a C testcase besides
    a C++ one too.
    
    Tested for x86_64-linux-gnu.
    
            PR tree-optimization/116824
    
    gcc/testsuite/ChangeLog:
    
            * gcc.dg/tree-ssa/phiprop-2.c: New test.
    
    Signed-off-by: Andrew Pinski <quic_apin...@quicinc.com>

Diff:
---
 gcc/testsuite/gcc.dg/tree-ssa/phiprop-2.c | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)

diff --git a/gcc/testsuite/gcc.dg/tree-ssa/phiprop-2.c 
b/gcc/testsuite/gcc.dg/tree-ssa/phiprop-2.c
new file mode 100644
index 000000000000..7181787db5eb
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/phiprop-2.c
@@ -0,0 +1,28 @@
+/* { dg-do compile } */
+/* { dg-options "-O1 -fdump-tree-phiopt2 -fdump-tree-phiprop1-details" } */
+
+/* PR tree-optimization/116824 */
+
+int g(int i, int *tt)
+{
+  const int t = 10;
+  const int *a;
+  {
+    if (t < i)
+    {
+      *tt = 1;
+      a = &t;
+    }
+    else
+    {
+      *tt = 1;
+      a = &i;
+    }
+  }
+  return *a;
+}
+
+/* Check that phiprop1 can do the insert of the loads. */
+/* { dg-final { scan-tree-dump-times "Inserting PHI for result of load" 1 
"phiprop1"} } */
+/* Should be able to get MIN_EXPR in phiopt2 after cselim and phiprop. */
+/* { dg-final { scan-tree-dump-times "MIN_EXPR " 1 "phiopt2" } } */

Reply via email to