On Tue, Aug 11, 2026 at 5:43 PM Eikansh Gupta <[email protected]> wrote: > > analyze_and_compute_bitop_with_inv_effect replaces a loop that repeatedly > applies a bitwise op with a loop-invariant operand by its closed form. The > BIT_XOR case only handled a constant trip count; for a variable count it > bailed out, leaving loops like "for (i=0;i<n;i++) j ^= 1;" in place. > > Mask the invariant with that runtime parity to handle a variable count. > A constant count folds as before. > > PR tree-optimization/112104 > > gcc/ChangeLog: > > * tree-scalar-evolution.cc > (analyze_and_compute_bitop_with_inv_effect): > Handle BIT_XOR_EXPR with a variable trip count. > > gcc/testsuite/ChangeLog: > > * gcc.target/i386/pr105735-1.c: Bump final value replacement count > from 8 to 9. > * gcc.target/i386/pr105735-3.c: Likewise. > * gcc.dg/tree-ssa/pr112104-1.c: New test. > * gcc.dg/tree-ssa/pr112104-2.c: New test. >
This caused: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=126971 -- H.J.
