From: Bill Wendling Date: Sun, 4 Sep 2011 09:02:18 +0000 (+0000) Subject: The insertion point for the loads is right before the llvm.eh.exception X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=66d1836380f128b07ef962dd7012ee6755884600;p=oota-llvm.git The insertion point for the loads is right before the llvm.eh.exception call. The call may be in the same BB as the landingpad instruction. If that's the case, then inserting the loads after the landingpad inst, but before the extractvalues, causes undefined behavior. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@139088 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/VMCore/AutoUpgrade.cpp b/lib/VMCore/AutoUpgrade.cpp index a7f5888ea5d..572018105aa 100644 --- a/lib/VMCore/AutoUpgrade.cpp +++ b/lib/VMCore/AutoUpgrade.cpp @@ -487,7 +487,7 @@ void llvm::UpgradeExceptionHandling(Module *M) { std::pair ExnSelSlots = FnToLPadSlotMap[Parent->getParent()]; IRBuilder<> Builder(Context); - Builder.SetInsertPoint(Parent, Parent->getFirstInsertionPt()); + Builder.SetInsertPoint(Parent, Exn); LoadInst *LPExn = Builder.CreateLoad(ExnSelSlots.first, "exn.load"); LoadInst *LPSel = Builder.CreateLoad(ExnSelSlots.second, "sel.load");