This is an archive of the discontinued LLVM Phabricator instance.

Handle cast instructions in complete loop unroll heuristic.
ClosedPublic

Authored by mzolotukhin on Jun 2 2015, 6:26 PM.

Details

Summary

Cast instructions are important to handle since induction variables are often extended to 64-bits.
This patch is intended to be applied after D10205 (though it could be applied independently with minor changes).

Diff Detail

Repository
rL LLVM

Event Timeline

mzolotukhin updated this revision to Diff 27022.Jun 2 2015, 6:26 PM
mzolotukhin retitled this revision from to Handle cast instructions in complete loop unroll heuristic..
mzolotukhin updated this object.
mzolotukhin edited the test plan for this revision. (Show Details)
mzolotukhin added a reviewer: chandlerc.
mzolotukhin added a subscriber: Unknown Object (MLST).
mzolotukhin updated this revision to Diff 27091.Jun 3 2015, 9:54 PM
  • Don't try to const-prop casts if the simplified value is just an offset from a base pointer.
chandlerc edited edge metadata.Jun 4 2015, 5:21 PM

No test case here? Is this covered by the tests in D10208?

lib/Transforms/Scalar/LoopUnrollPass.cpp
430–434 ↗(On Diff #27091)

I think the need for this will go away when offsets aren't (incorrectly) marked as needed in SimplifiedValues. See my comments is D10205.

436 ↗(On Diff #27091)

This doesn't seem to be specific to ptrtoint. =]

mzolotukhin updated this revision to Diff 27261.Jun 5 2015, 9:09 PM
mzolotukhin edited edge metadata.
  • Fallback to Base visitor if failed to constant fold (and only then call simplifyInstWithSCEV).
  • Add TODO to visitCast.

No test case here? Is this covered by the tests in D10208?

Yes, all tests are in D10208.

This patch looks fine, but I'd like to have a test case that specifically exercises it. Is that possible given the current state, or does that come in a subsequent patch?

lib/Transforms/Scalar/LoopUnrollPass.cpp
444 ↗(On Diff #27261)

This comment still seems stale (referring to ptrtoint).

chandlerc accepted this revision.Jul 14 2015, 3:27 PM
chandlerc edited edge metadata.

Just as a note, this LGTM provided a minimal test change is included when it is committed.

This revision is now accepted and ready to land.Jul 14 2015, 3:27 PM
This revision was automatically updated to reflect the committed changes.

Thanks!

I added a new test here and committed the patch (with comment fixed too) in r242257.