[PATCH] [WinEH] Split blocks at calls to llvm.eh.begincatch.

Reid Kleckner rnk at google.com
Tue Apr 28 13:34:30 PDT 2015


lgtm

Yeah, I was worrying about DominatorTree preservation when I added those splitBasicBlock calls. Nothing seemed to break, so I went with it, which is always dangerous. :)


REPOSITORY
  rL LLVM

================
Comment at: lib/CodeGen/WinEHPrepare.cpp:409-411
@@ +408,5 @@
+
+  // If either operand is in the same basic block as the instruction and
+  // isn't used by another instruction before the begincatch call, include it
+  // in the split block.
+  auto *Op0 = dyn_cast<Instruction>(II->getOperand(0));
----------------
Hm, I guess this funny business is needed to allow bitcasts and extractvalue? I guess it prevents us from demoting too much stuff.

================
Comment at: lib/CodeGen/WinEHPrepare.cpp:418
@@ +417,3 @@
+
+  while (I == Op0 || I == Op1) {
+    // If the block begins with one of the operands and there are no other
----------------
You should check `I != nullptr` in this condition because Op0 and Op1 could be null if the catch parameter is null. Null is not an instruction, so the dyn_cast will fail, and we might call getPrevNode() on null.

http://reviews.llvm.org/D9311

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






More information about the llvm-commits mailing list