[SEH] Don't assert if the parent function lacks a personality
[oota-llvm.git] / lib / Target / X86 / X86ISelLowering.cpp
index 6d4f817ad67c1a7c3a8333fef18c1d99a6390c50..eab9e0fbe5b453e23d6acca171313860c5c89244 100644 (file)
@@ -15011,6 +15011,12 @@ static SDValue recoverFramePointer(SelectionDAG &DAG, const Function *Fn,
   const TargetLowering &TLI = DAG.getTargetLoweringInfo();
   MVT PtrVT = TLI.getPointerTy();
 
+  // It's possible that the parent function no longer has a personality function
+  // if the exceptional code was optimized away, in which case we just return
+  // the incoming EBP.
+  if (!Fn->hasPersonalityFn())
+    return EntryEBP;
+
   // The RegNodeSize is 6 32-bit words for SEH and 4 for C++ EH. See
   // WinEHStatePass for the full struct definition.
   int RegNodeSize;