[PATCH] D11750: [WinEHPrepare] Add rudimentary support for the new EH instructions

Reid Kleckner via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 6 11:39:01 PDT 2015


rnk added a comment.

The demotion logic seems pretty heinous, but I hear improvements are on the way, so I'm not going to dig too much into it.


================
Comment at: lib/CodeGen/WinEHPrepare.cpp:2922
@@ +2921,3 @@
+  // Initialize the worklist with the funclet's entry point.
+  std::vector<BasicBlock *> Worklist;
+  Worklist.push_back(InitialBB);
----------------
I expect many cleanup funclets will be one BB. SmallVector<1>?

================
Comment at: lib/CodeGen/WinEHPrepare.cpp:2926-2927
@@ +2925,4 @@
+  while (!Worklist.empty()) {
+    BasicBlock *BB = Worklist.back();
+    Worklist.pop_back();
+
----------------
pop_back_val?

================
Comment at: lib/CodeGen/WinEHPrepare.cpp:2942-2947
@@ +2941,8 @@
+    Instruction *Terminator = BB->getTerminator();
+    // The catchret's successors cannot be part of the funclet.
+    if (IsCatch && isa<CatchReturnInst>(Terminator))
+      continue;
+    // The cleanupret's successors cannot be part of the funclet.
+    if (IsCleanup && isa<CleanupReturnInst>(Terminator))
+      continue;
+
----------------
I think you can remove the `IsCatch` and `IsCleanup` predicates and stop at either kind of ret. If the CFG gets mangled, this will stop us from going off into the weeds earlier.

================
Comment at: lib/CodeGen/WinEHPrepare.cpp:3244
@@ +3243,3 @@
+
+  // Recolor the CFG to verify that all is well.
+  for (BasicBlock &BB : F) {
----------------
Do you want these in a release build? #ifndef NDEBUG?


http://reviews.llvm.org/D11750





More information about the llvm-commits mailing list