Move Value::getUnderlyingObject to be a standalone

function so that it can live in Analysis instead of
VMCore.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121885 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Dan Gohman
2010-12-15 20:02:24 +00:00
parent d5f4bc2c33
commit 5034dd318a
16 changed files with 68 additions and 61 deletions

View File

@ -233,7 +233,7 @@ static Value *GetLinearExpression(Value *V, APInt &Scale, APInt &Offset,
/// the gep cannot necessarily be reconstructed from its decomposed form.
///
/// When TargetData is around, this function is capable of analyzing everything
/// that Value::getUnderlyingObject() can look through. When not, it just looks
/// that GetUnderlyingObject can look through. When not, it just looks
/// through pointer casts.
///
static const Value *
@ -528,7 +528,7 @@ BasicAliasAnalysis::pointsToConstantMemory(const Location &Loc, bool OrLocal) {
SmallVector<const Value *, 16> Worklist;
Worklist.push_back(Loc.Ptr);
do {
const Value *V = Worklist.pop_back_val()->getUnderlyingObject();
const Value *V = GetUnderlyingObject(Worklist.pop_back_val());
if (!Visited.insert(V)) {
Visited.clear();
return AliasAnalysis::pointsToConstantMemory(Loc, OrLocal);
@ -633,7 +633,7 @@ BasicAliasAnalysis::getModRefInfo(ImmutableCallSite CS,
assert(notDifferentParent(CS.getInstruction(), Loc.Ptr) &&
"AliasAnalysis query involving multiple functions!");
const Value *Object = Loc.Ptr->getUnderlyingObject();
const Value *Object = GetUnderlyingObject(Loc.Ptr);
// If this is a tail call and Loc.Ptr points to a stack location, we know that
// the tail call cannot access or modify the local stack.
@ -761,7 +761,7 @@ BasicAliasAnalysis::getModRefInfo(ImmutableCallSite CS,
/// aliasGEP - Provide a bunch of ad-hoc rules to disambiguate a GEP instruction
/// against another pointer. We know that V1 is a GEP, but we don't know
/// anything about V2. UnderlyingV1 is GEP1->getUnderlyingObject(),
/// anything about V2. UnderlyingV1 is GetUnderlyingObject(GEP1),
/// UnderlyingV2 is the same for V2.
///
AliasAnalysis::AliasResult
@ -807,7 +807,7 @@ BasicAliasAnalysis::aliasGEP(const GEPOperator *GEP1, uint64_t V1Size,
// to handle without it.
if (GEP1BasePtr != UnderlyingV1 || GEP2BasePtr != UnderlyingV2) {
assert(TD == 0 &&
"DecomposeGEPExpression and getUnderlyingObject disagree!");
"DecomposeGEPExpression and GetUnderlyingObject disagree!");
return MayAlias;
}
@ -843,7 +843,7 @@ BasicAliasAnalysis::aliasGEP(const GEPOperator *GEP1, uint64_t V1Size,
// to handle without it.
if (GEP1BasePtr != UnderlyingV1) {
assert(TD == 0 &&
"DecomposeGEPExpression and getUnderlyingObject disagree!");
"DecomposeGEPExpression and GetUnderlyingObject disagree!");
return MayAlias;
}
}
@ -1044,8 +1044,8 @@ BasicAliasAnalysis::aliasCheck(const Value *V1, uint64_t V1Size,
return NoAlias; // Scalars cannot alias each other
// Figure out what objects these things are pointing to if we can.
const Value *O1 = V1->getUnderlyingObject();
const Value *O2 = V2->getUnderlyingObject();
const Value *O1 = GetUnderlyingObject(V1);
const Value *O2 = GetUnderlyingObject(V2);
// Null values in the default address space don't point to any object, so they
// don't alias any other pointer.