This is an archive of the discontinued LLVM Phabricator instance.

[LoopUnroll] Fix truncation bug in canUnrollCompletely.
ClosedPublic

Authored by sanjoy on Jun 5 2015, 7:19 PM.

Details

Summary

canUnrollCompletely takes unsigned values for UnrolledCost and
RolledDynamicCost but is passed in uint64_ts that are silently
truncated. Because of this, when UnrolledSize is a large integer
that has a small remainder with UINT32_MAX, LLVM tries to completely
unroll loops with high trip counts.

Diff Detail

Event Timeline

sanjoy updated this revision to Diff 27253.Jun 5 2015, 7:19 PM
sanjoy retitled this revision from to [LoopUnroll] Fix truncation bug in canUnrollCompletely..
sanjoy updated this object.
sanjoy edited the test plan for this revision. (Show Details)
sanjoy added reviewers: mzolotukhin, chandlerc.
sanjoy added a subscriber: Unknown Object (MLST).
sanjoy updated this object.Jun 5 2015, 7:22 PM
mzolotukhin edited edge metadata.Jun 5 2015, 7:33 PM

LGTM.

I've seen that bug, and I believed that I've fixed it - but probably it got lost in reviews and did make it to trunk. Thank you for catching it!

Michael

mzolotukhin accepted this revision.Jun 5 2015, 7:33 PM
mzolotukhin edited edge metadata.
This revision is now accepted and ready to land.Jun 5 2015, 7:33 PM

In my previous comment: s/did make/did not make/

This revision was automatically updated to reflect the committed changes.