forked from OSchip/llvm-project
4a000883c7
This was reverted in r306252, but I already had the bug fixed and was just trying to form a test case. The original commit factored the logic for forming dedicated exits inside of LoopSimplify into a helper that could be used elsewhere and with an approach that required fewer intermediate data structures. See that commit for full details including the change to the statistic, etc. The code looked fine to me and my reviewers, but in fact didn't handle indirectbr correctly -- it left the 'InLoopPredecessors' vector dirty. If you have code that looks *just* right, you can end up leaking these predecessors into a subsequent rewrite, and crash deep down when trying to update PHI nodes for predecessors that don't exist. I've added an assert that makes the bug much more obvious, and then changed the code to reliably clear the vector so we don't get this bug again in some other form as the code changes. I've also added a test case that *does* manage to catch this while also giving some nice positive coverage in the face of indirectbr. The real code that found this came out of what I think is CPython's interpreter loop, but any code with really "creative" interpreter loops mixing indirectbr and other exit paths could manage to tickle the bug. I was hard to reduce the original test case because in addition to having a particular pattern of IR, the whole thing depends on the order of the predecessors which is in turn depends on use list order. The test case added here was designed so that in multiple different predecessor orderings it should always end up going down the same path and tripping the same bug. I hope. At least, it tripped it for me without manipulating the use list order which is better than anything bugpoint could do... llvm-svn: 306257 |
||
---|---|---|
.. | ||
2003-04-25-AssertFail.ll | ||
2003-05-12-PreheaderExitOfChild.ll | ||
2003-08-15-PreheadersFail.ll | ||
2003-12-10-ExitBlocksProblem.ll | ||
2004-02-05-DominatorInfoCorruption.ll | ||
2004-03-15-IncorrectDomUpdate.ll | ||
2004-04-01-IncorrectDomUpdate.ll | ||
2004-04-12-LoopSimplify-SwitchBackedges.ll | ||
2004-04-13-LoopSimplifyUpdateDomFrontier.ll | ||
2007-10-28-InvokeCrash.ll | ||
2010-07-15-IncorrectDomFrontierUpdate.ll | ||
2010-12-26-PHIInfiniteLoop.ll | ||
2011-12-14-LandingpadHeader.ll | ||
2012-03-20-indirectbr.ll | ||
ashr-crash.ll | ||
basictest.ll | ||
dbg-loc.ll | ||
dup-preds.ll | ||
hardertest.ll | ||
indirectbr-backedge.ll | ||
indirectbr.ll | ||
merge-exits.ll | ||
notify-scev.ll | ||
phi-node-simplify.ll | ||
pr26682.ll | ||
pr28272.ll | ||
pr30454.ll | ||
preserve-llvm-loop-metadata.ll | ||
preserve-scev.ll | ||
single-backedge.ll | ||
unreachable-loop-pred.ll |