r16-2648-gaebbc90d8c7c70 had a copy and pasto where the second statement was supposed to be setting the operand 1 of the phi but it was setting operand 0 instead. This fixes typo.
Push as obvious after a quick build test for x86_64-linux-gnu. PR tree-optimization/121695 gcc/ChangeLog: * tree-if-conv.cc (factor_out_operators): Fix typo in assignment of the phi. gcc/testsuite/ChangeLog: * gcc.dg/torture/pr121695-1.c: New test. Signed-off-by: Andrew Pinski <andrew.pin...@oss.qualcomm.com> --- gcc/testsuite/gcc.dg/torture/pr121695-1.c | 25 +++++++++++++++++++++++ gcc/tree-if-conv.cc | 2 +- 2 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gcc.dg/torture/pr121695-1.c diff --git a/gcc/testsuite/gcc.dg/torture/pr121695-1.c b/gcc/testsuite/gcc.dg/torture/pr121695-1.c new file mode 100644 index 00000000000..877c9c90b11 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr121695-1.c @@ -0,0 +1,25 @@ +/* { dg-do compile } */ +/* PR tree-optimization/121695 */ + +int ac; +char p; +int *r; +static unsigned t = 7; +int q() { + int v; +af: { + int ag[3]; + int *ah = &ag[1]; + for (; ac;) { + int ai = 3971866093; + if (0 >= *ah && (*r = 1)) + *ah &= ai; + else { + if (p) + goto af; + *ah &= t; + } + } +} + return v; +} diff --git a/gcc/tree-if-conv.cc b/gcc/tree-if-conv.cc index b7ce0720b15..e96c89ea791 100644 --- a/gcc/tree-if-conv.cc +++ b/gcc/tree-if-conv.cc @@ -2295,7 +2295,7 @@ again: /* Update the phi node too. */ gimple_phi_set_result (phi, new_res); gimple_phi_arg (phi, 0)->def = new_arg0; - gimple_phi_arg (phi, 0)->def = new_arg1; + gimple_phi_arg (phi, 1)->def = new_arg1; update_stmt (phi); repeated = true; -- 2.43.0