Don't crash on bogus llvm.noinline. This is first part of PR1817 (preventing reduction)
authorAnton Korobeynikov <asl@math.spbu.ru>
Thu, 22 Nov 2007 22:30:10 +0000 (22:30 +0000)
committerAnton Korobeynikov <asl@math.spbu.ru>
Thu, 22 Nov 2007 22:30:10 +0000 (22:30 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44281 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/IPO/InlineSimple.cpp

index 38bf0610b3872e84c2b5792cef96db1b77facc24..ebd8a595f21eb924fcb6b4163ca95c19bd5034be 100644 (file)
@@ -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<ConstantArray>(GV->getInitializer());
   
   if (InitList == 0)