[PATCH] Remap arguments and non-alloca values used by outlined C++ exception handlers.

Reid Kleckner rnk at google.com
Tue Feb 24 11:07:11 PST 2015


lgtm

Can you make sure these files aren't committed with DOS line endings? The last few commits have had them.

Ultimately I want to come up with a better solution than Demote*ToStack, but it'll work for now.


REPOSITORY
  rL LLVM

================
Comment at: lib/CodeGen/WinEHPrepare.cpp:343
@@ -332,1 +342,3 @@
   // that get the equivalent pointer from the frame allocation struct.
+  Instruction *FrameEHDataInst = dyn_cast<Instruction>(FrameEHData);
+  BasicBlock::iterator II = FrameEHDataInst;
----------------
If the cast can never fail, use cast<> over dyn_cast<> so that it's checked with an assertion. Otherwise the ++II will just crash in a less obvious way.

================
Comment at: lib/CodeGen/WinEHPrepare.cpp:370-372
@@ +369,5 @@
+        ParentAlloca = DemoteRegToStack(*SI, true, SI);
+      } else if (auto *PN = dyn_cast<PHINode>(ParentVal))
+        ParentAlloca = DemotePHIToStack(PN, AllocaInsertPt);
+      else {
+        Instruction *ParentInst = dyn_cast<Instruction>(ParentVal);
----------------
While LLVM does elide braces when possible, we usually try to stay consistent with braces or no braces across an else-if chain.

================
Comment at: lib/CodeGen/WinEHPrepare.cpp:373-374
@@ +372,4 @@
+      else {
+        Instruction *ParentInst = dyn_cast<Instruction>(ParentVal);
+        assert(ParentInst);
+        ParentAlloca = DemoteRegToStack(*ParentInst, true, ParentInst);
----------------
This is just cast<Instruction>(ParentVal);

http://reviews.llvm.org/D7844

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






More information about the llvm-commits mailing list