This is an archive of the discontinued LLVM Phabricator instance.

[LoopPeel] Forget SCEV for updated exit phi values.
ClosedPublic

Authored by fhahn on Jun 20 2022, 2:13 AM.

Details

Summary

LoopPeel add new incoming values to exit phi nodes which can change the
SCEV for the phi after 20d798bd47ec51.

Forget SCEVs for such phis.

Fixes #56044.

Diff Detail

Event Timeline

fhahn created this revision.Jun 20 2022, 2:13 AM
Herald added a project: Restricted Project. · View Herald TranscriptJun 20 2022, 2:13 AM
fhahn requested review of this revision.Jun 20 2022, 2:13 AM
Herald added a project: Restricted Project. · View Herald TranscriptJun 20 2022, 2:13 AM
fhahn retitled this revision from [LoopPeel] Forget updated exit phi values. to [LoopPeel] Forget SCEV for updated exit phi values..Jun 20 2022, 2:21 AM
nikic added a comment.Jun 20 2022, 2:23 AM

This looks reasonable to me -- only thing that's not entirely clear to me is why forgetTopmostLoop() doesn't end up doing this. The forgetLoop() implementation is very aggressive, and I would have expected that the use-def walk would reach the exit phis as well.

fhahn added a comment.Jun 20 2022, 2:28 AM

This looks reasonable to me -- only thing that's not entirely clear to me is why forgetTopmostLoop() doesn't end up doing this. The forgetLoop() implementation is very aggressive, and I would have expected that the use-def walk would reach the exit phis as well.

It looks like forgetLoop only invalidates uses of AddRecs, headers phis and BTC users. The problematic phi here is %lcssa.1 which is not reachable through any of the roots forgetLoop uses for invalidation.

nikic accepted this revision.Jun 20 2022, 2:37 AM

Makes sense, thanks for checking! LGTM in that case.

This revision is now accepted and ready to land.Jun 20 2022, 2:37 AM
This revision was landed with ongoing or failed builds.Jun 20 2022, 4:20 AM
This revision was automatically updated to reflect the committed changes.