mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-25 13:24:46 +00:00
Teach IndVarSimplify's FixUsesBeforeDefs to handle InvokeInsts by
assuming that the use of the value is in a block dominated by the "normal" destination. LangRef.html and other documentation sources don't explicitly guarantee this, but it seems to be assumed in other places in LLVM at least. This fixes an assertion failure on the included testcase, which is derived from the Ada testsuite. FixUsesBeforeDefs is a temporary measure which I'm looking to replace with a more capable solution. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72266 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -662,7 +662,11 @@ void IndVarSimplify::FixUsesBeforeDefs(Loop *L, SCEVExpander &Rewriter) {
|
||||
if (Z != NumPredsLeft.end() && Z->second != 0 && --Z->second == 0) {
|
||||
SmallVector<Instruction *, 4> UseWorkList;
|
||||
UseWorkList.push_back(Inst);
|
||||
BasicBlock::iterator InsertPt = next(I);
|
||||
BasicBlock::iterator InsertPt = I;
|
||||
if (InvokeInst *II = dyn_cast<InvokeInst>(InsertPt))
|
||||
InsertPt = II->getNormalDest()->begin();
|
||||
else
|
||||
++InsertPt;
|
||||
while (isa<PHINode>(InsertPt)) ++InsertPt;
|
||||
do {
|
||||
Instruction *Use = UseWorkList.pop_back_val();
|
||||
|
Reference in New Issue
Block a user