]> granicus.if.org Git - clang/commitdiff
Don't get the exception obj from the slot more than once.
authorBill Wendling <isanbard@gmail.com>
Thu, 8 Dec 2011 23:21:26 +0000 (23:21 +0000)
committerBill Wendling <isanbard@gmail.com>
Thu, 8 Dec 2011 23:21:26 +0000 (23:21 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146202 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/CGException.cpp

index 5b5d8b4f0239e741984b7072219f14f983d92354..15d8d42fa2c71a7d47f5c573c0e14efcd2399f89 100644 (file)
@@ -1523,14 +1523,13 @@ llvm::BasicBlock *CodeGenFunction::getEHResumeBlock() {
                        getExceptionFromSlot())
       ->setDoesNotReturn();
   } else {
-    llvm::Value *Exn = getExceptionFromSlot();
-
     switch (CleanupHackLevel) {
     case CHL_MandatoryCatchall:
       // In mandatory-catchall mode, we need to use
       // _Unwind_Resume_or_Rethrow, or whatever the personality's
       // equivalent is.
-      Builder.CreateCall(getUnwindResumeOrRethrowFn(), Exn)
+      Builder.CreateCall(getUnwindResumeOrRethrowFn(),
+                         getExceptionFromSlot())
         ->setDoesNotReturn();
       break;
     case CHL_MandatoryCleanup: {
@@ -1554,7 +1553,7 @@ llvm::BasicBlock *CodeGenFunction::getEHResumeBlock() {
       // In an idealized mode where we don't have to worry about the
       // optimizer combining landing pads, we should just use
       // _Unwind_Resume (or the personality's equivalent).
-      Builder.CreateCall(getUnwindResumeFn(), Exn)
+      Builder.CreateCall(getUnwindResumeFn(), getExceptionFromSlot())
         ->setDoesNotReturn();
       break;
     }