From 17fe6c48ffd966433496d0cd4b62215c9dc60982 Mon Sep 17 00:00:00 2001 From: Bill Wendling Date: Sat, 3 Sep 2011 01:38:17 +0000 Subject: [PATCH] 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 --- lib/VMCore/AutoUpgrade.cpp | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/lib/VMCore/AutoUpgrade.cpp b/lib/VMCore/AutoUpgrade.cpp index dc66ad7c47c..a7f5888ea5d 100644 --- a/lib/VMCore/AutoUpgrade.cpp +++ b/lib/VMCore/AutoUpgrade.cpp @@ -510,18 +510,15 @@ void llvm::UpgradeExceptionHandling(Module *M) { while (!EHResume->use_empty()) { CallInst *Resume = cast(EHResume->use_back()); BasicBlock *BB = Resume->getParent(); - Function *Fn = BB->getParent(); - std::pair &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.'