[PATCH] [WinEH] Demote values live across exception handlers up front

Andy Kaylor andrew.kaylor at intel.com
Tue Apr 21 11:49:58 PDT 2015


================
Comment at: lib/CodeGen/WinEHPrepare.cpp:383
@@ +382,3 @@
+    auto *Br = dyn_cast<BranchInst>(BB->getTerminator());
+    if (Br && Br->getPrevNode() &&
+        match(Br->getPrevNode(), m_Intrinsic<Intrinsic::eh_endcatch>()))
----------------
Can you add a comment here explaining that the blocks have been split to ensure that the endcatch call will immediately precede the terminator?

================
Comment at: lib/CodeGen/WinEHPrepare.cpp:427
@@ +426,3 @@
+        // The next BB is normal control flow.
+        Worklist.insert(BB->getTerminator()->getSuccessor(0));
+        break;
----------------
This doesn't seem right.  A nested landing pad block generally begins with a call to endcatch, but it isn't a normal block.

================
Comment at: lib/CodeGen/WinEHPrepare.cpp:460
@@ +459,3 @@
+        if (auto *Arg = dyn_cast<Argument>(Op)) {
+          if (IsEHBB) {
+            DEBUG(dbgs() << "Demoting argument " << *Arg
----------------
Does this demote arguments in EH blocks even if the value is defined in an EH block?

Also, isn't this going to demote the landing pad values which we will later promote?

================
Comment at: lib/CodeGen/WinEHPrepare.cpp:508
@@ +507,3 @@
+    }
+    new StoreInst(Arg, Slot, AllocaInsertPt);
+  }
----------------
Is this inserting the store in the entry block?  That doesn't sound right.

http://reviews.llvm.org/D9158

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/






More information about the llvm-commits mailing list