This is an archive of the discontinued LLVM Phabricator instance.

[IRCE] Bail out if Start AddRec is for another loop
ClosedPublic

Authored by dmakogon on Nov 11 2022, 2:51 AM.

Details

Summary

Imagine we have an outer loop and an inner loop, which is in the outer one, and a range check in outer loop of such addrec:

{{0,+,1}<%outer_header>,+,1}<%inner_header>

When IRCE runs on the outer loop it sees the range check and tries to check whether it is possible to safely calculate the loop bound.
However, this addrec is for the inner loop, so we shouldn't do anything at all.

Fixes https://github.com/llvm/llvm-project/issues/58912

Diff Detail

Event Timeline

dmakogon created this revision.Nov 11 2022, 2:51 AM
Herald added a project: Restricted Project. · View Herald TranscriptNov 11 2022, 2:51 AM
Herald added a subscriber: hiraditya. · View Herald Transcript
dmakogon requested review of this revision.Nov 11 2022, 2:51 AM
Herald added a project: Restricted Project. · View Herald TranscriptNov 11 2022, 2:51 AM
mkazantsev accepted this revision.Nov 11 2022, 3:21 AM

LG with nits.

llvm/lib/Transforms/Scalar/InductiveRangeCheckElimination.cpp
849

Looks weird w.r.t. messages right below, better "LHS in cmp is not an AddRec for this loop"

llvm/test/Transforms/IRCE/iv-for-another-loop.ll
2–3

Add new PM.

8

Remove this and auto-generate checks.

This revision is now accepted and ready to land.Nov 11 2022, 3:21 AM

Add "PR58912" to commit name.

dmakogon updated this revision to Diff 475062.Nov 14 2022, 12:04 AM

Updated comment and test

This revision was landed with ongoing or failed builds.Nov 14 2022, 12:12 AM
This revision was automatically updated to reflect the committed changes.