[WinEH] Fix problem with landing pad return values used in PHI nodes during outlining.
[oota-llvm.git] / lib / CodeGen / WinEHPrepare.cpp
index cba9ea530ba251b4407dd0644e8ced12e92207f0..f4e810d8173dabe8816cac67383f4334cdfd003c 100644 (file)
@@ -904,6 +904,10 @@ bool WinEHPrepare::outlineHandler(ActionHandler *Action, Function *SrcFn,
     ++II;
   }
 
+  // The landing pad value may be used by PHI nodes.  It will ultimately be
+  // eliminated, but we need it in the map for intermediate handling.
+  VMap[LPad] = UndefValue::get(LPad->getType());
+
   // Skip over PHIs and, if applicable, landingpad instructions.
   II = StartBB->getFirstInsertionPt();