This is an archive of the discontinued LLVM Phabricator instance.

[LoopInterchange] Improve inner exit loop safety checks.
ClosedPublic

Authored by fhahn on Sep 27 2019, 9:28 AM.

Details

Summary

The PHI node checks for inner loop exits are too permissive currently.
As indicated by an existing comment, we should only allow LCSSA PHI
nodes that are part of reductions or are only used outside of the loop
nest. We ensure this by checking the users of the LCSSA PHIs.
Specifically, it is not safe to use an exiting value from the inner loop in the latch of the outer
loop.

It also moves the inner loop exit check before the outer loop exit
check.

Fixes PR43473.

Event Timeline

fhahn created this revision.Sep 27 2019, 9:28 AM
Herald added a project: Restricted Project. · View Herald TranscriptSep 27 2019, 9:29 AM
Herald added a subscriber: hiraditya. · View Herald Transcript
fhahn edited the summary of this revision. (Show Details)Oct 7 2019, 8:25 AM

ping

efriedma accepted this revision.Dec 3 2019, 4:46 PM

LGTM

This revision is now accepted and ready to land.Dec 3 2019, 4:46 PM
This revision was automatically updated to reflect the committed changes.