summaryrefslogtreecommitdiff
path: root/lib/Transforms
diff options
context:
space:
mode:
authorNick Lewycky <nicholas@mxc.ca>2013-07-25 02:55:14 +0000
committerNick Lewycky <nicholas@mxc.ca>2013-07-25 02:55:14 +0000
commitb97b1627316ef4a9eb7591ef4f814917ba054ff6 (patch)
tree6cec003f84bb5da6f0978b552fb4d48ce0d35c4a /lib/Transforms
parent2d680824e3a5272e386aa6c1d2a66676de7899fd (diff)
downloadllvm-b97b1627316ef4a9eb7591ef4f814917ba054ff6.tar.gz
llvm-b97b1627316ef4a9eb7591ef4f814917ba054ff6.tar.bz2
llvm-b97b1627316ef4a9eb7591ef4f814917ba054ff6.tar.xz
Check that TD isn't NULL before dereferencing it down this path.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@187099 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms')
-rw-r--r--lib/Transforms/IPO/GlobalOpt.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/Transforms/IPO/GlobalOpt.cpp b/lib/Transforms/IPO/GlobalOpt.cpp
index 6250cc5ec4..20af15ed00 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<GlobalVariable>(Ptr)) {
Type *ElemTy = cast<PointerType>(GV->getType())->getElementType();
- if (!Size->isAllOnesValue() &&
+ if (TD && !Size->isAllOnesValue() &&
Size->getValue().getLimitedValue() >=
TD->getTypeStoreSize(ElemTy)) {
Invariants.insert(GV);