[PATCH] D12434: [WinEH] Teach SimplfyCFG to eliminate empty cleanup pads.

Andy Kaylor via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 28 14:15:19 PDT 2015


andrew.w.kaylor added a comment.

> What about something like <snip> ?


Yeah, that does it.  I guess I need to add support for that now.


================
Comment at: lib/Transforms/Utils/SimplifyCFG.cpp:2965
@@ -2938,1 +2964,3 @@
+  BasicBlock *BB = RI->getParent();
+  Instruction *CPInst = cast<CleanupPadInst>(BB->getFirstNonPHI());
 
----------------
JosephTremoulet wrote:
> Cleanups can have internal control flow, so this `cast` could fail.  Presumably you want a `dyn_cast` and return `false` if it returns `nullptr`, since that would indicate a non-empty cleanup?  (I'm not sure if this routine should be assuming that trivial flow will have already been removed or not)
Oops.  I actually had the dyn_cast in there and then I removed it this morning as I was doing final cleanup of this code.  That's what I get for trying to doing something before the morning caffeine kicks in.

================
Comment at: test/Transforms/SimplifyCFG/empty-cleanuppad.ll:70-72
@@ +69,5 @@
+; CHECK:   catchret
+; CHECK-NOT: cleanuppad
+; CHECK: catchendblock:                                    ; preds = %catch.dispatch
+; CHECK:   catchendpad unwind to caller
+; CHECK: }
----------------
JosephTremoulet wrote:
> Should the CHECK-NOT follow the two CHECKs here instead of preceding them?  In the input the cleanup comes after the catchendpad.
In this case the first cleanuppad sticks around and the one below the catchpad/catchret is removed, but I do still have this line misplaced.  It should be below the catchendpad.


Repository:
  rL LLVM

http://reviews.llvm.org/D12434





More information about the llvm-commits mailing list