From: Chris Lattner Date: Mon, 26 Sep 2005 07:34:35 +0000 (+0000) Subject: Add a debug printout, fix a crash on kc++ X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=aae4a1cd3f5d41d0b909a75b4f5699b20605db5e;p=oota-llvm.git Add a debug printout, fix a crash on kc++ git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23450 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Transforms/IPO/GlobalOpt.cpp b/lib/Transforms/IPO/GlobalOpt.cpp index 7b06e41374b..fe805f414ac 100644 --- a/lib/Transforms/IPO/GlobalOpt.cpp +++ b/lib/Transforms/IPO/GlobalOpt.cpp @@ -320,7 +320,9 @@ static bool CleanupConstantGlobalUsers(Value *V, Constant *Init) { Changed = true; } else if (ConstantExpr *CE = dyn_cast(U)) { if (CE->getOpcode() == Instruction::GetElementPtr) { - Constant *SubInit = ConstantFoldLoadThroughGEPConstantExpr(Init, CE); + Constant *SubInit = 0; + if (Init) + SubInit = ConstantFoldLoadThroughGEPConstantExpr(Init, CE); Changed |= CleanupConstantGlobalUsers(CE, SubInit); } else if (CE->getOpcode() == Instruction::Cast && isa(CE->getType())) { @@ -1481,6 +1483,9 @@ static bool EvaluateStaticConstructor(Function *F) { for (std::map::iterator I = MutatedMemory.begin(), E = MutatedMemory.end(); I != E; ++I) CommitValueTo(I->second, I->first); + + DEBUG(std::cerr << "FULLY EVALUATED GLOBAL CTOR FUNCTION '" << + F->getName() << "'\n"); return true; }