aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Transforms/IPO
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2005-09-26 07:34:35 +0000
committerChris Lattner <sabre@nondot.org>2005-09-26 07:34:35 +0000
commitaae4a1cd3f5d41d0b909a75b4f5699b20605db5e (patch)
treeb2d0d4654ab4e555e6ef2706bab11310e95091ed /lib/Transforms/IPO
parent798b4d5bb32d51f9fed87893f65ea571fd90b161 (diff)
downloadexternal_llvm-aae4a1cd3f5d41d0b909a75b4f5699b20605db5e.zip
external_llvm-aae4a1cd3f5d41d0b909a75b4f5699b20605db5e.tar.gz
external_llvm-aae4a1cd3f5d41d0b909a75b4f5699b20605db5e.tar.bz2
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
Diffstat (limited to 'lib/Transforms/IPO')
-rw-r--r--lib/Transforms/IPO/GlobalOpt.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/Transforms/IPO/GlobalOpt.cpp b/lib/Transforms/IPO/GlobalOpt.cpp
index 7b06e41..fe805f4 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<ConstantExpr>(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<PointerType>(CE->getType())) {
@@ -1481,6 +1483,9 @@ static bool EvaluateStaticConstructor(Function *F) {
for (std::map<Constant*, Constant*>::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;
}