https://gcc.gnu.org/g:a78f34b6d21da299429f2432b309781ad717c596
commit r16-3419-ga78f34b6d21da299429f2432b309781ad717c596 Author: Andrew Pinski <andrew.pin...@oss.qualcomm.com> Date: Wed Aug 27 11:59:08 2025 -0700 ifcvt: fix factor_out_operators (again) [PR121695] 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> Diff: --- gcc/testsuite/gcc.dg/torture/pr121695-1.c | 25 +++++++++++++++++++++++++ gcc/tree-if-conv.cc | 2 +- 2 files changed, 26 insertions(+), 1 deletion(-) 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 000000000000..877c9c90b11d --- /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 b7ce0720b150..e96c89ea7918 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;