X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=lib%2FTransforms%2FIPO%2FGlobalOpt.cpp;h=20af15ed0087119c37d0541b99bde1b8f7ba63d5;hb=b97b1627316ef4a9eb7591ef4f814917ba054ff6;hp=183a599bc1226d476101d741efda8aa12f51b438;hpb=64f2f910bd48c123a6b5945ebe90b018f7bea4d5;p=oota-llvm.git diff --git a/lib/Transforms/IPO/GlobalOpt.cpp b/lib/Transforms/IPO/GlobalOpt.cpp index 183a599bc12..20af15ed008 100644 --- a/lib/Transforms/IPO/GlobalOpt.cpp +++ b/lib/Transforms/IPO/GlobalOpt.cpp @@ -2783,7 +2783,7 @@ bool Evaluator::EvaluateBlock(BasicBlock::iterator CurInst, Value *Ptr = PtrArg->stripPointerCasts(); if (GlobalVariable *GV = dyn_cast(Ptr)) { Type *ElemTy = cast(GV->getType())->getElementType(); - if (!Size->isAllOnesValue() && + if (TD && !Size->isAllOnesValue() && Size->getValue().getLimitedValue() >= TD->getTypeStoreSize(ElemTy)) { Invariants.insert(GV); @@ -3043,7 +3043,7 @@ bool GlobalOpt::OptimizeGlobalCtorsList(GlobalVariable *&GCL) { /// \brief Given "llvm.used" or "llvm.compiler.used" as a global name, collect /// the initializer elements of that global in Set and return the global itself. static GlobalVariable * -collectUsedGlobalVariables(const Module &M, const char *Name, +collectUsedGlobalVariables(Module &M, const char *Name, SmallPtrSet &Set) { GlobalVariable *GV = M.getGlobalVariable(Name); if (!GV || !GV->hasInitializer()) @@ -3106,7 +3106,7 @@ class LLVMUsed { GlobalVariable *CompilerUsedV; public: - LLVMUsed(const Module &M) { + LLVMUsed(Module &M) { UsedV = collectUsedGlobalVariables(M, "llvm.used", Used); CompilerUsedV = collectUsedGlobalVariables(M, "llvm.compiler.used", CompilerUsed);