[LoopRotate] Drop loop dispositions when rotating loops. PR56260
authorMax Kazantsev <mkazantsev@azul.com>
Mon, 19 Sep 2022 10:52:55 +0000 (17:52 +0700)
committerMax Kazantsev <mkazantsev@azul.com>
Mon, 19 Sep 2022 11:01:02 +0000 (18:01 +0700)
commit92e9bddc49b6c7bf6c5d59d7dad4ec8255d01c20
tree3bab62e50f10aeb5f3eeec9c8fb6c6bababa9fe8
parentd953d0173776e7f7109b35ac2e74259dd126ab74
[LoopRotate] Drop loop dispositions when rotating loops. PR56260

This is required because if there is a pure loop-invariant instruction, Loop Rotation
may decide to not clone it and just hoist it instead. If SCEV has previously cached
that it was loop-variant (not being smart enough to prove invariance), we may end
up with inconsistent cache state (which may later trigger false-negative assertion
failures checking that something was invariant).

This is a conservative fix that unconditionally drops the dispositions. We could
only drop it if the hoisting has actually happened, but it should take some time
understanding whether it's safe with all other things this function does.

Differential Revision: https://reviews.llvm.org/D134167
Reviewed By: fhahn
llvm/lib/Transforms/Utils/LoopRotationUtils.cpp
llvm/test/Transforms/LoopRotate/pr56260.ll [new file with mode: 0644]