[PUSHED 1/3] testsuite: Add phiopt factoring testcase for restrict
Andrea Pinski <[email protected]> Sat, 1 Aug 2026 22:36:00 -0700
| Newsgroups | gmane.comp.gcc.patches |
|---|---|
| Message-ID | <[email protected]> |
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 <[email protected]> --- .../gcc.dg/tree-ssa/factor_op_phi-restrict-1.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/tree-ssa/factor_op_phi-restrict-1.c 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" } } */ -- 2.43.0