This is an archive of the discontinued LLVM Phabricator instance.

[LoopUnrollAnalyzer] Check that we're using SCEV for the same loop we're simulating.
ClosedPublic

Authored by mzolotukhin on Feb 25 2016, 5:59 PM.

Details

Summary

Check that we're using SCEV for the same loop we're simulating. Otherwise, we might try to use the iteration number of the current loop in SCEV expressions for inner/outer loops IVs, which is clearly incorrect.

Diff Detail

Event Timeline

mzolotukhin retitled this revision from to [LoopUnrollAnalyzer] Check that we're using SCEV for the same loop we're simulating..
mzolotukhin updated this object.
mzolotukhin added reviewers: chandlerc, hfinkel.
mzolotukhin added a subscriber: llvm-commits.

Minor drop by comments inline

lib/Analysis/LoopUnrollAnalyzer.cpp
40

Nit: why not change this to if (!AR || AR->getLoop() != L)?

unittests/Analysis/UnrollAnalyzer.cpp
132

Do we actually need the trailing newlines? I don't think the parser actually cares, and they're somewhat distracting.

  • Remove trailing newlines.
  • Combine two conditions in simplifyInstWithSCEV.
mzolotukhin marked 2 inline comments as done.Feb 25 2016, 6:28 PM

Thanks, Sanjoy! I updated the patch accordingly.

Michael

sanjoy accepted this revision.Feb 25 2016, 6:51 PM
sanjoy added a reviewer: sanjoy.

lgtm

I don't know this area of code well, but this change looks fairly simple and obvious

This revision is now accepted and ready to land.Feb 25 2016, 6:51 PM
This revision was automatically updated to reflect the committed changes.

Thanks! It looks like the newlines are actually necessary, so I returned them in the committed patch.

Michael