This is an archive of the discontinued LLVM Phabricator instance.

Fix infinite loop in Shrink Wrapping
ClosedPublic

Authored by kbarton on Jul 29 2015, 1:55 PM.

Details

Reviewers
qcolombet
Summary

There is an infinite loop that can occur in Shrink Wrapping while searching for the Save/Restore points.
Part of this search checks whether the save/restore points are located in different loop nests and if so, uses the (post) dominator trees to find the immediate (post) dominator blocks. However, if the current block does not have any immediate (post) dominators then this search will result in an infinite loop. This can occur in code containing an infinite loop.

The modification checks whether the immediate (post) dominator is different from the current save/restore block. If it is not, then the search terminates and the current location is not considered as a valid save/restore point for shrink wrapping.

Diff Detail

Event Timeline

kbarton updated this revision to Diff 30943.Jul 29 2015, 1:55 PM
kbarton retitled this revision from to Fix infinite loop in Shrink Wrapping.
kbarton updated this object.
kbarton added a reviewer: qcolombet.
kbarton added subscribers: llvm-commits, wschmidt, hfinkel.
qcolombet accepted this revision.Jul 29 2015, 2:17 PM
qcolombet edited edge metadata.

Hi Kit,

Nice catch!

LGTM.

Thanks,
-Quentin

lib/CodeGen/ShrinkWrap.cpp
300

s/NULL/nullptr/

313

Ditto.

This revision is now accepted and ready to land.Jul 29 2015, 2:17 PM
kbarton closed this revision.Aug 6 2015, 12:02 PM

Committed revision 244247.