[PATCH] Add a Windows EH preparation pass that zaps resumes

David Majnemer david.majnemer at gmail.com
Tue Jan 27 19:24:48 PST 2015


I don't see an IR->IR test, could we have one for this transform?


================
Comment at: lib/CodeGen/WinEHPrepare.cpp:28-29
@@ +27,4 @@
+
+namespace {
+  class WinEHPrepare : public FunctionPass {
+    const TargetMachine *TM;
----------------
I wouldn't indent `WinEHPrepare`: http://llvm.org/docs/CodingStandards.html#namespace-indentation

================
Comment at: lib/CodeGen/WinEHPrepare.cpp:78
@@ +77,3 @@
+  // Classify the personality to see what kind of preparation we need.
+  EHPersonality Pers = ClassifyEHPersonality(LPads[0]->getPersonalityFn());
+
----------------
`LPads.back()` perhaps?

I bet you intended on using this `LPads` vector in the future, right now it seems pretty useless though.

================
Comment at: lib/CodeGen/WinEHPrepare.cpp:92-93
@@ +91,4 @@
+    IRBuilder<> Builder(Resume);
+    Builder.CreateCall(Trap);
+    Builder.CreateUnreachable();
+    Resume->eraseFromParent();
----------------
Why do you create a call to `@llvm.trap` and an `unreachable` instruction?

================
Comment at: lib/CodeGen/WinEHPrepare.cpp:101
@@ +100,3 @@
+bool WinEHPrepare::doFinalization(Module &M) {
+  return DwarfPrepare->doFinalization(M);
+}
----------------
Does it make sense to do this unconditionally, even if the function has MSVC personality?

================
Comment at: lib/CodeGen/WinEHPrepare.cpp:105
@@ +104,3 @@
+void WinEHPrepare::getAnalysisUsage(AnalysisUsage &AU) const {
+  DwarfPrepare->getAnalysisUsage(AU);
+}
----------------
Does it make sense to do this unconditionally, even if the function has MSVC personality?

http://reviews.llvm.org/D7216

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






More information about the llvm-commits mailing list