[PATCH] D14842: [WinEH] Fix two cases where instructions can incorrectly be inserted into EH pads

David Majnemer via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 19 13:20:31 PST 2015


majnemer added a comment.

I'd commit these as two different commits seeing as how they are independent of each other.


================
Comment at: lib/CodeGen/CodeGenPrepare.cpp:732-735
@@ +731,6 @@
+    // cast.
+    if (UserBB->isEHPad()) {
+      auto *T = UserBB->getTerminator();
+      if (isa<TerminatePadInst>(T) || isa<CatchEndPadInst>(T) ||
+          isa<CleanupEndPadInst>(T) || isa<CatchPadInst>(T))
+        continue;
----------------
Likewise, I'd change this to simply be `UserBB->getTerminator()->isEHPad()`

================
Comment at: lib/Transforms/Scalar/GVN.cpp:1557-1560
@@ +1556,6 @@
+    // instructions before the terminator, we can't PRE the load.
+    if (Pred->isEHPad()) {
+      auto *T = Pred->getTerminator();
+      if (isa<TerminatePadInst>(T) || isa<CatchEndPadInst>(T) ||
+          isa<CleanupEndPadInst>(T) || isa<CatchPadInst>(T)) {
+        DEBUG(dbgs()
----------------
I believe this can be simplified to `if (Pred->getTerminator()->isEHPad())` because the only case where this comes up is when the terminator is also an EH pad.


Repository:
  rL LLVM

http://reviews.llvm.org/D14842





More information about the llvm-commits mailing list