[PATCH] D15140: Update clang to use the updated LLVM EH instructions

Reid Kleckner via cfe-commits cfe-commits at lists.llvm.org
Fri Dec 11 11:07:19 PST 2015


rnk added inline comments.

================
Comment at: lib/CodeGen/CGCall.cpp:3482
@@ +3481,3 @@
+             &EHPersonality::get(*this) ==
+                 &EHPersonality::MSVC_CxxFrameHandler3) {
+    // The MSVC++ personality will implicitly terminate the program if an
----------------
I guess we have a cleaner way of writing this:
  EHPersonality::get(*this).isMSVCXXPersonality()

================
Comment at: lib/CodeGen/CGException.cpp:899
@@ -892,10 +898,3 @@
 
-    // If this is the last handler, we're at the end, and the next
-    // block is the block for the enclosing EH scope.
-    if (I + 1 == E) {
-      NextBlock = CGF.createBasicBlock("catchendblock");
-      CGBuilderTy(CGF, NextBlock).CreateCatchEndPad(
-          CGF.getEHDispatchBlock(CatchScope.getEnclosingEHScope()));
-    } else {
-      NextBlock = CGF.createBasicBlock("catch.dispatch");
-    }
+    llvm::BasicBlock *CatchPadBB = CGF.createBasicBlock("catch");
+    CGF.EmitBlock(CatchPadBB);
----------------
This creates one extra basic block per catch handler. Why not insert the catchpadinst directly into Handler.Block, emit Handler.Block, and add Handler.Block to the switch?

If this disturbs the test cases too much, then we can punt on it for now.

================
Comment at: lib/CodeGen/CGException.cpp:910
@@ -911,3 +909,3 @@
 
-    // Otherwise we need to emit and continue at that block.
-    CGF.EmitBlock(NextBlock);
+    CGF.Builder.CreateBr(Handler.Block);
+
----------------
If we go with the suggestion above, we don't need this Br.

================
Comment at: lib/CodeGen/MicrosoftCXXABI.cpp:896-897
@@ -895,4 +895,4 @@
   VarDecl *CatchParam = S->getExceptionDecl();
   llvm::BasicBlock *CatchPadBB =
       CGF.Builder.GetInsertBlock()->getSinglePredecessor();
   llvm::CatchPadInst *CPI =
----------------
If we emit the catchpadinst into Handler.Block, we can drop the 'getSinglePredecessor' call.


http://reviews.llvm.org/D15140





More information about the cfe-commits mailing list