Make sure we don't insert instructions before a landingpad instruction.
<rdar://problem/10405911>

llvm-svn: 144000
diff --git a/llvm/lib/Transforms/Utils/DemoteRegToStack.cpp b/llvm/lib/Transforms/Utils/DemoteRegToStack.cpp
index 8cc2649..3ef6b01 100644
--- a/llvm/lib/Transforms/Utils/DemoteRegToStack.cpp
+++ b/llvm/lib/Transforms/Utils/DemoteRegToStack.cpp
@@ -97,8 +97,8 @@
     InsertPt = II.getNormalDest()->begin();
   }
 
-  for (; isa<PHINode>(InsertPt); ++InsertPt)
-  /* empty */;   // Don't insert before any PHI nodes.
+  for (; isa<PHINode>(InsertPt) || isa<LandingPadInst>(InsertPt); ++InsertPt)
+  /* empty */;   // Don't insert before any PHI nodes or landingpad instrs.
   new StoreInst(&I, Slot, InsertPt);
 
   return Slot;