diff --git a/lib/Transforms/IPO/InlineSimple.cpp b/lib/Transforms/IPO/InlineSimple.cpp index 38bf0610b38..ebd8a595f21 100644 --- a/lib/Transforms/IPO/InlineSimple.cpp +++ b/lib/Transforms/IPO/InlineSimple.cpp @@ -59,6 +59,10 @@ bool SimpleInliner::doInitialization(CallGraph &CG) { if (GV == 0) return false; + // Don't crash on invalid code + if (!GV->hasInitializer()) + return false; + const ConstantArray *InitList = dyn_cast(GV->getInitializer()); if (InitList == 0)