From: Andrea Pinski Date: Sat, 1 Aug 2026 23:25:22 +0000 (-0700) Subject: testsuite: Add phiopt factoring testcase for restrict X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b3e78a17714908dbcd4b968a6c567ce75d424487;p=thirdparty%2Fgcc.git testsuite: Add phiopt factoring testcase for restrict I missed this testcase when factoring of loads was added. I thought it would be a good thing to add just to make sure it is handled correctly. gcc/testsuite/ChangeLog: * gcc.dg/tree-ssa/factor_op_phi-restrict-1.c: New test. Signed-off-by: Andrea Pinski --- diff --git a/gcc/testsuite/gcc.dg/tree-ssa/factor_op_phi-restrict-1.c b/gcc/testsuite/gcc.dg/tree-ssa/factor_op_phi-restrict-1.c new file mode 100644 index 00000000000..67baf8b2a4f --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/factor_op_phi-restrict-1.c @@ -0,0 +1,16 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-phiopt-details-alias" } */ +/* Testcase to make sure restrict works correctly by zeroing out clique/base. */ + +int +f (int c, int * __restrict fp, int *q) +{ + int r; + if (c) + r = *fp; + else + r = *q; + return r + 1; +} +/* { dg-final { scan-tree-dump-times "changed to factor out load from" 1 "phiopt2" } } */ +/* { dg-final { scan-tree-dump-not "clique " "phiopt2" } } */