This is an archive of the discontinued LLVM Phabricator instance.

[IndVars] Call replaceLoopPHINodesWithPreheaderValues() for already constant exits
ClosedPublic

Authored by nikic on Jul 6 2022, 8:30 AM.

Details

Summary

Currently we only call replaceLoopPHINodesWithPreheaderValues() if optimizeLoopExits() replaces the exit with an unconditional exit. However, it is very common that this already happens as part of eliminateIVComparison(), in which case we're leaving behind the dead header phi.

Tweak the early bailout for already-constant exits to also call replaceLoopPHINodesWithPreheaderValues().

Diff Detail

Event Timeline

nikic created this revision.Jul 6 2022, 8:30 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 6 2022, 8:30 AM
Herald added a subscriber: hiraditya. · View Herald Transcript
nikic requested review of this revision.Jul 6 2022, 8:30 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 6 2022, 8:30 AM
mkazantsev accepted this revision.Jul 12 2022, 6:41 AM
This revision is now accepted and ready to land.Jul 12 2022, 6:41 AM
This revision was landed with ongoing or failed builds.Jul 13 2022, 12:43 AM
This revision was automatically updated to reflect the committed changes.