[PATCH] Extended support for native Windows C++ EH outlining

Reid Kleckner rnk at google.com
Tue Mar 10 18:16:37 PDT 2015


I think this is pretty close.


REPOSITORY
  rL LLVM

================
Comment at: lib/CodeGen/WinEHPrepare.cpp:1116-1117
@@ +1115,4 @@
+//
+// FIXME: Update this to avoid re-parsing blocks that are shared by multiple
+//        landingpads.
+void WinEHPrepare::mapLandingPadBlocks(LandingPadInst *LPad,
----------------
I think if we can resolve this, it'll greatly simplify the code and reduce the amount of repeated selector analysis.

================
Comment at: lib/CodeGen/WinEHPrepare.cpp:1284
@@ +1283,3 @@
+    if (CleanupHandlerMap.count(BB)) {
+      ActionHandler;
+      if (auto *Action = CleanupHandlerMap[BB]) {
----------------
Does this do anything?

================
Comment at: lib/CodeGen/WinEHPrepare.cpp:1301-1304
@@ +1300,6 @@
+        assert(Compare->isEquality());
+        if (Compare->getPredicate() == CmpInst::ICMP_EQ)
+          BB = Branch->getSuccessor(1);
+        else
+          BB = Branch->getSuccessor(0);
+        continue;
----------------
Don't we need to analyze the condition more to know which BB is the fallthrough side?

================
Comment at: lib/CodeGen/WinEHPrepare.cpp:1318-1322
@@ +1317,7 @@
+    bool IsLandingPadBB = BB->isLandingPad();
+    LandingPadMapper LPadMapper;
+    if (IsLandingPadBB) {
+      LandingPadInst *LPad = BB->getLandingPadInst();
+      LPadMapper.mapLandingPad(LPad);
+    }
+
----------------
This seems like a lot of work, we end up mapping the same landingpads over and over in inner loops. Maybe we should have a map for each landing pad and just look them up inside the cloning directors?

================
Comment at: lib/CodeGen/WinEHPrepare.cpp:1336-1338
@@ +1335,5 @@
+        if (!Insert2) {
+          CleanupHandler *Action = new CleanupHandler(BB);
+          CleanupHandlerMap[BB] = Action;
+          return Action;
+        }
----------------
I feel like this repeated stanza could be simplified to something like:
  return createCleanupHandler(CleanupHandlerMap, BB);

  void createCleanupHandler(CleanupHandlerMapTy &Map, BasicBlock *BB) {
    auto *Action = new CleanupHandler(BB);
    Map[BB] = Action;
    return Action;
  }

http://reviews.llvm.org/D7886

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






More information about the llvm-commits mailing list