aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Analysis/ValueTracking.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/ValueTracking.cpp
parent0e3fae27a1634f51943d06588e32a550dae6a4b9 (diff)
downloadexternal_llvm-bd1801b5553c8be3960255a92738464e0010b6f6.zip
external_llvm-bd1801b5553c8be3960255a92738464e0010b6f6.tar.gz
external_llvm-bd1801b5553c8be3960255a92738464e0010b6f6.tar.bz2
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/ValueTracking.cpp')
-rw-r--r--lib/Analysis/ValueTracking.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/Analysis/ValueTracking.cpp b/lib/Analysis/ValueTracking.cpp
index e2d7e92..c982e3e 100644
--- a/lib/Analysis/ValueTracking.cpp
+++ b/lib/Analysis/ValueTracking.cpp
@@ -1504,7 +1504,8 @@ uint64_t llvm::GetStringLength(Value *V) {
return Len == ~0ULL ? 1 : Len;
}
-Value *llvm::GetUnderlyingObject(Value *V, unsigned MaxLookup) {
+Value *
+llvm::GetUnderlyingObject(Value *V, const TargetData *TD, unsigned MaxLookup) {
if (!V->getType()->isPointerTy())
return V;
for (unsigned Count = 0; MaxLookup == 0 || Count < MaxLookup; ++Count) {
@@ -1519,8 +1520,8 @@ Value *llvm::GetUnderlyingObject(Value *V, unsigned MaxLookup) {
} else {
// See if InstructionSimplify knows any relevant tricks.
if (Instruction *I = dyn_cast<Instruction>(V))
- // TODO: Aquire TargetData and DominatorTree and use them.
- if (Value *Simplified = SimplifyInstruction(I, 0, 0)) {
+ // TODO: Aquire a DominatorTree and use it.
+ if (Value *Simplified = SimplifyInstruction(I, TD, 0)) {
V = Simplified;
continue;
}