From 311c4b6e9867bba83fdd9b52c3746b203a3d829d Mon Sep 17 00:00:00 2001 From: Anton Korobeynikov Date: Thu, 22 Nov 2007 22:30:10 +0000 Subject: [PATCH] Don't crash on bogus llvm.noinline. This is first part of PR1817 (preventing reduction) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44281 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Transforms/IPO/InlineSimple.cpp | 4 ++++ 1 file changed, 4 insertions(+) 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)