Don't reload the values that are already there. The llvm.eh.resume uses the same

values that the resume instruction uses.
PR10850


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@139076 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Bill Wendling 2011-09-03 01:38:17 +00:00
parent 5a76f00108
commit 17fe6c48ff

View File

@ -510,18 +510,15 @@ void llvm::UpgradeExceptionHandling(Module *M) {
while (!EHResume->use_empty()) {
CallInst *Resume = cast<CallInst>(EHResume->use_back());
BasicBlock *BB = Resume->getParent();
Function *Fn = BB->getParent();
std::pair<Value*, Value*> &ExnSel = FnToLPadSlotMap[Fn];
IRBuilder<> Builder(Context);
Builder.SetInsertPoint(BB, Resume);
Value *Exn = Builder.CreateLoad(ExnSel.first, "exn");
Value *Sel = Builder.CreateLoad(ExnSel.second, "sel");
Value *LPadVal =
Builder.CreateInsertValue(UndefValue::get(LPadSlotTy),
Exn, 0, "lpad.val");
LPadVal = Builder.CreateInsertValue(LPadVal, Sel, 1, "lpad.val");
Resume->getArgOperand(0), 0, "lpad.val");
LPadVal = Builder.CreateInsertValue(LPadVal, Resume->getArgOperand(1),
1, "lpad.val");
Builder.CreateResume(LPadVal);
// Remove all instructions after the 'resume.'