summaryrefslogtreecommitdiff
path: root/lib/Analysis/ConstantFolding.cpp
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2011-01-24 18:53:32 +0000
committerDan Gohman <gohman@apple.com>2011-01-24 18:53:32 +0000
commitbd1801b5553c8be3960255a92738464e0010b6f6 (patch)
tree838d8bf88ac48fbc8cc9df6be1cbc9df3067e2f7 /lib/Analysis/ConstantFolding.cpp
parent0e3fae27a1634f51943d06588e32a550dae6a4b9 (diff)
downloadllvm-bd1801b5553c8be3960255a92738464e0010b6f6.tar.gz
llvm-bd1801b5553c8be3960255a92738464e0010b6f6.tar.bz2
llvm-bd1801b5553c8be3960255a92738464e0010b6f6.tar.xz
Give GetUnderlyingObject a TargetData, to keep it in sync
with BasicAA's DecomposeGEPExpression, which recently began using a TargetData. This fixes PR8968, though the testcase is awkward to reduce. Also, update several off GetUnderlyingObject's users which happen to have a TargetData handy to pass it in. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124134 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/ConstantFolding.cpp')
-rw-r--r--lib/Analysis/ConstantFolding.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/Analysis/ConstantFolding.cpp b/lib/Analysis/ConstantFolding.cpp
index 55a10d716b..243611053c 100644
--- a/lib/Analysis/ConstantFolding.cpp
+++ b/lib/Analysis/ConstantFolding.cpp
@@ -467,7 +467,8 @@ Constant *llvm::ConstantFoldLoadFromConstPtr(Constant *C,
// If this load comes from anywhere in a constant global, and if the global
// is all undef or zero, we know what it loads.
- if (GlobalVariable *GV = dyn_cast<GlobalVariable>(GetUnderlyingObject(CE))){
+ if (GlobalVariable *GV =
+ dyn_cast<GlobalVariable>(GetUnderlyingObject(CE, TD))) {
if (GV->isConstant() && GV->hasDefinitiveInitializer()) {
const Type *ResTy = cast<PointerType>(C->getType())->getElementType();
if (GV->getInitializer()->isNullValue())