Insert stores after phi nodes in the normal dest. This fixes

LowerInvoke/2005-08-03-InvokeWithPHI.ll

llvm-svn: 23525
This commit is contained in:
Chris Lattner 2005-09-29 17:44:20 +00:00
parent 02d3ba3db8
commit a554c9470b
1 changed files with 5 additions and 2 deletions

View File

@ -259,8 +259,11 @@ void LowerInvoke::rewriteExpensiveInvoke(InvokeInst *II, unsigned InvokeNo,
// Insert a store of the invoke num before the invoke and store zero into the
// location afterward.
new StoreInst(InvokeNoC, InvokeNum, true, II); // volatile
new StoreInst(Constant::getNullValue(Type::UIntTy), InvokeNum, false,
II->getNormalDest()->begin()); // nonvolatile.
BasicBlock::iterator NI = II->getNormalDest()->begin();
while (isa<PHINode>(NI)) ++NI;
// nonvolatile.
new StoreInst(Constant::getNullValue(Type::UIntTy), InvokeNum, false, NI);
// Add a switch case to our unwind block.
CatchSwitch->addCase(InvokeNoC, II->getUnwindDest());