This is an archive of the discontinued LLVM Phabricator instance.

[Loop] Move block and loop dispo invalidation to makeLoopInvariant.
ClosedPublic

Authored by fhahn on Oct 13 2022, 12:47 PM.

Details

Summary

makeLoopInvariant may recursively move its operands to make them
invariant, before moving the passed in instruction. Those recursively
moved instructions are currently missed when invalidating block and loop
dispositions.

To address this, move the invalidation code to Loop::makeLoopInvariant.

Fixes #58314.

Diff Detail

Event Timeline

fhahn created this revision.Oct 13 2022, 12:47 PM
Herald added a project: Restricted Project. · View Herald TranscriptOct 13 2022, 12:47 PM
Herald added a subscriber: hiraditya. · View Herald Transcript
fhahn requested review of this revision.Oct 13 2022, 12:47 PM
Herald added a project: Restricted Project. · View Herald TranscriptOct 13 2022, 12:47 PM
fhahn edited the summary of this revision. (Show Details)Oct 13 2022, 12:49 PM
nikic added a comment.Oct 13 2022, 1:44 PM

Generally LGTM, but don't you need to adjust the usage in LoopSimplify as well?

fhahn added a comment.Oct 13 2022, 1:52 PM

Generally LGTM, but don't you need to adjust the usage in LoopSimplify as well?

Yes we should probably update all users that preserve SCEV in general. We unfortunately don't have SCEV verification tests for LoopSimplify, but I'll see if I can add one.

fhahn updated this revision to Diff 467802.Oct 14 2022, 9:29 AM

Generally LGTM, but don't you need to adjust the usage in LoopSimplify as well?

Yes we should probably update all users that preserve SCEV in general. We unfortunately don't have SCEV verification tests for LoopSimplify, but I'll see if I can add one.

I wasn't able to come up with a loop-simplify test case, but I updated the use of makeLoopInvariant in LoopSimplify.

fhahn retitled this revision from [LoopDeletion] Move block and loop dispo invalidation to makeLoopInvar. to [Loop] Move block and loop dispo invalidation to makeLoopInvariant..Oct 14 2022, 9:30 AM
nikic accepted this revision.Oct 14 2022, 11:53 AM

LGTM

This revision is now accepted and ready to land.Oct 14 2022, 11:53 AM