]> git.ipfire.org Git - thirdparty/gcc.git/commit
middle-end: don't cache restart_loop in vectorizable_live_operations [PR113808]
authorTamar Christina <tamar.christina@arm.com>
Thu, 8 Feb 2024 10:43:13 +0000 (10:43 +0000)
committerTamar Christina <tamar.christina@arm.com>
Thu, 8 Feb 2024 10:43:13 +0000 (10:43 +0000)
commit3f69db1812106cb5bab203e17a60300ac51cdc68
tree5bd81c7f1c003fe3f32d1a118b07b9a3dde8f778
parente515d813f080fb4c4e70d3c7b01815a909893688
middle-end: don't cache restart_loop in vectorizable_live_operations [PR113808]

There's a bug in vectorizable_live_operation that restart_loop is defined
outside the loop.

This variable is supposed to indicate whether we are doing a first or last
index reduction.  The problem is that by defining it outside the loop it becomes
dependent on the order we visit the USE/DEFs.

In the given example, the loop isn't PEELED, but we visit the early exit uses
first.  This then sets the boolean to true and it can't get to false again.

So when we visit the main exit we still treat it as an early exit for that
SSA name.

This cleans it up and renames the variables to something that's hopefully
clearer to their intention.

gcc/ChangeLog:

PR tree-optimization/113808
* tree-vect-loop.cc (vectorizable_live_operation): Don't cache the
value cross iterations.

gcc/testsuite/ChangeLog:

PR tree-optimization/113808
* gfortran.dg/vect/vect-early-break_1-PR113808.f90: New test.
gcc/testsuite/gfortran.dg/vect/vect-early-break_1-PR113808.f90 [new file with mode: 0644]
gcc/tree-vect-loop.cc