]> git.ipfire.org Git - thirdparty/gcc.git/commit
tree-optimization/117510 - fix guard hoisting validity check
authorRichard Biener <rguenther@suse.de>
Mon, 11 Nov 2024 08:40:20 +0000 (09:40 +0100)
committerRichard Biener <rguenth@gcc.gnu.org>
Mon, 11 Nov 2024 12:03:16 +0000 (13:03 +0100)
commitda64698159fe69b68f5264b54cebcb67c501b3cf
tree90c97c81ecc5eefb0adf760946a9b84f3dd22d96
parent95960cd473297cd0d2c9e75a1a424b870cee32f5
tree-optimization/117510 - fix guard hoisting validity check

For the loop in the testcase we currently fail to hoist the guard
check of the inner loop (m > 0) out of the outer loop because
find_loop_guard checks all blocks of the outer loop for side-effects,
including those that are skipped by the guard.  This usually
is harmless as the guard does not skip any blocks in the outer loop
but in this case store-motion was applied to the inner loop and thus
there's now a skipped store in the outer loop.

The following properly skips blocks that are dominated by the
entry to the skipped region.

PR tree-optimization/117510
* tree-ssa-loop-unswitch.cc (find_loop_guard): Only check
not skipped blocks for side-effects.

* gcc.dg/vect/vect-outer-pr117510.c: New testcase.
gcc/testsuite/gcc.dg/vect/vect-outer-pr117510.c [new file with mode: 0644]
gcc/tree-ssa-loop-unswitch.cc