[PATCH] D15840: [WinEH] Update catchrets with cloned successors

David Majnemer via llvm-commits llvm-commits at lists.llvm.org
Sat Jan 2 00:46:32 PST 2016


majnemer added a comment.

A-ha, we generate the following IR which upsets the verifier (when running with -disable-cleanups):

  join:                                             ; preds = %pad.outer, %pad.inner
    %phi = phi i32 [ 1, %pad.inner ], [ 2, %pad.outer ]
    call void @llvm.foo(i32 %phi)
    unreachable
  
  join.for.entry:                                   ; No predecessors!
    %phi.for.entry = phi i32 
    call void @llvm.foo(i32 %phi.for.entry)
    unreachable


================
Comment at: lib/CodeGen/WinEHPrepare.cpp:701
@@ +700,3 @@
+                dyn_cast<CatchReturnInst>(IncomingBlock->getTerminator())) {
+          BlockInFunclet = (CRI->getParentPad() == FuncletToken);
+        } else {
----------------
Can we think of a better name than `BlockInFunclet`?  In this case, we are checking to make sure that the catchret's target makes sense given it's parent funclet.

================
Comment at: lib/CodeGen/WinEHPrepare.cpp:704
@@ +703,3 @@
+          ColorVector &IncomingColors = BlockColors[IncomingBlock];
+          assert(IncomingColors.size() && "Block not colored!");
+          assert((IncomingColors.size() == 1 ||
----------------
I'd write this as `!IncomingColors.empty()`.


http://reviews.llvm.org/D15840





More information about the llvm-commits mailing list