[PATCH] D13623: [WinEH] Iterate state changes instead of invokes

Reid Kleckner via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 12 14:14:03 PDT 2015


rnk accepted this revision.
rnk added a comment.
This revision is now accepted and ready to land.

lgtm

Thanks for taking this on, I think the state machine for detecting invoke ranges is pretty subtle and I'd rather not have three of them. It's not as simple as I hoped it'd be, but it seems like an improvement over what we had before.


================
Comment at: lib/CodeGen/AsmPrinter/WinException.cpp:406
@@ +405,3 @@
+      const MachineInstr &MI = *MBBI;
+      if (MI.isEHLabel()) {
+        MCSymbol *Label = MI.getOperand(0).getMCSymbol();
----------------
You can save a level of indentation by handling the MI.isCall() case before the isEHLabel() check, and then changing this check to
  if (!MI.isEHLabel())
    continue;

================
Comment at: lib/CodeGen/AsmPrinter/WinException.cpp:534
@@ +533,3 @@
+  MachineFunction::const_iterator End = MF->end();
+  MachineFunction::const_iterator Stop = std::next(MF->begin());
+  while (Stop != End && !Stop->isEHFuncletEntry())
----------------
We don't actually need this std::next, the entry block should never return true for `isEHFuncletEntry`. David pointed this out to me in person last week.


http://reviews.llvm.org/D13623





More information about the llvm-commits mailing list