This is an archive of the discontinued LLVM Phabricator instance.

[LAA] Prevent invalid IR for loop-invariant bound in loop body
ClosedPublic

Authored by loladiro on Dec 4 2016, 4:27 PM.

Details

Summary

If LAA expands a bound that is loop invariant, but not hoisted out
of the loop body, it used to use that value anyway, causing a
non-domination error, because the memcheck block is of course not
dominated by the scalar loop body. Detect this situation and expand
the SCEV expression instead.

Fixes PR31251

Please note, I don't know this part of the code base at all, so while
I patched up the symptoms, there may be something more fundamental at
play here that I'm oblivious to.

Diff Detail

Repository
rL LLVM

Event Timeline

loladiro updated this revision to Diff 80220.Dec 4 2016, 4:27 PM
loladiro retitled this revision from to [LAA] Prevent invalid IR for loop-invariant bound in loop body.
loladiro updated this object.
loladiro added reviewers: hfinkel, anemet.
loladiro added a subscriber: llvm-commits.
mkuper added a subscriber: mkuper.Dec 4 2016, 4:59 PM
anemet accepted this revision.Dec 5 2016, 10:07 AM
anemet edited edge metadata.

LGTM with the comments below. Thanks for the fix!

test/Analysis/LoopAccessAnalysis/loop-invariant-bound.ll
1 ↗(On Diff #80220)

This test should probably be formulated with -loop-versioning under Transform/LoopVersioning

4 ↗(On Diff #80220)

No need to specify the target triple.

This revision is now accepted and ready to land.Dec 5 2016, 10:07 AM
This revision was automatically updated to reflect the committed changes.