This is an archive of the discontinued LLVM Phabricator instance.

[SCEV] Update interface to handle SCEVExpander insert point motion.
ClosedPublic

Authored by gberry on Aug 9 2016, 7:51 PM.

Details

Summary

This is an extension of the fix in r271424. That fix dealt with builder
insert points being moved by SCEV expansion, but only for the lifetime
of the expand call. This change modifies the interface so that LSR can
safely call expand multiple times at the same insert point and do the
right thing if one of the expansions decides to move the original insert
point.

Diff Detail

Repository
rL LLVM

Event Timeline

gberry updated this revision to Diff 67454.Aug 9 2016, 7:51 PM
gberry retitled this revision from to [SCEV] Update interface to handle SCEVExpander insert point motion..
gberry updated this object.
gberry added a reviewer: sanjoy.
gberry added subscribers: mcrosier, llvm-commits.
hans added a subscriber: hans.

+Sanjoy and Hal, perhaps you could take a look?

This is for PR28719 which is a 3.9 blocker.

sanjoy accepted this revision.Aug 10 2016, 11:13 PM
sanjoy edited edge metadata.

lgtm, but at this point I'm wondering if there is something we can do to rule out this class of bugs. Any ideas @gberry? Or is the solution here just "be careful when using SCEVExpander".

test/Transforms/LoopStrengthReduce/X86/pr28719.ll
10 ↗(On Diff #67454)

Can you still please add a CHECK for something obvious, like CHECK-LABEL: @main( ?

This revision is now accepted and ready to land.Aug 10 2016, 11:13 PM

The only other solution that comes to mind is instead of fixing up the insert points, avoid moving them in the first place in SCEVExpander. I'm not familiar enough with that code to say whether that makes sense or would cause performance regressions. It's also probably a riskier fix for the release.

This revision was automatically updated to reflect the committed changes.