forked from OSchip/llvm-project
parent
696f043bc2
commit
9613b29927
|
@ -52,7 +52,7 @@ STATISTIC(SearchLimitReached, "Number of times the limit to "
|
|||
STATISTIC(SearchTimes, "Number of times a GEP is decomposed");
|
||||
|
||||
/// Cutoff after which to stop analysing a set of phi nodes potentially involved
|
||||
/// in a cycle. Because we are analysing 'through' phi nodes we need to be
|
||||
/// in a cycle. Because we are analysing 'through' phi nodes, we need to be
|
||||
/// careful with value equivalence. We use reachability to make sure a value
|
||||
/// cannot be involved in a cycle.
|
||||
const unsigned MaxNumPhiBBsValueReachabilityCheck = 20;
|
||||
|
@ -83,7 +83,7 @@ static bool isNonEscapingLocalObject(const Value *V) {
|
|||
// inside the function.
|
||||
if (const Argument *A = dyn_cast<Argument>(V))
|
||||
if (A->hasByValAttr() || A->hasNoAliasAttr())
|
||||
// Note even if the argument is marked nocapture we still need to check
|
||||
// Note even if the argument is marked nocapture, we still need to check
|
||||
// for copies made inside the function. The nocapture attribute only
|
||||
// specifies that there are no copies made that outlive the function.
|
||||
return !PointerMayBeCaptured(V, false, /*StoreCaptures=*/true);
|
||||
|
@ -106,7 +106,7 @@ static bool isEscapeSource(const Value *V) {
|
|||
return false;
|
||||
}
|
||||
|
||||
/// Returns the size of the object specified by V, or UnknownSize if unknown.
|
||||
/// Returns the size of the object specified by V or UnknownSize if unknown.
|
||||
static uint64_t getObjectSize(const Value *V, const DataLayout &DL,
|
||||
const TargetLibraryInfo &TLI,
|
||||
bool RoundToAlign = false) {
|
||||
|
@ -173,7 +173,7 @@ static bool isObjectSize(const Value *V, uint64_t Size, const DataLayout &DL,
|
|||
///
|
||||
/// Returns the scale and offset values as APInts and return V as a Value*, and
|
||||
/// return whether we looked through any sign or zero extends. The incoming
|
||||
/// Value is known to have IntegerType and it may already be sign or zero
|
||||
/// Value is known to have IntegerType, and it may already be sign or zero
|
||||
/// extended.
|
||||
///
|
||||
/// Note that this looks through extends, so the high bits may not be
|
||||
|
@ -192,8 +192,8 @@ static bool isObjectSize(const Value *V, uint64_t Size, const DataLayout &DL,
|
|||
}
|
||||
|
||||
if (const ConstantInt *Const = dyn_cast<ConstantInt>(V)) {
|
||||
// if it's a constant, just convert it to an offset and remove the variable.
|
||||
// If we've been called recursively the Offset bit width will be greater
|
||||
// If it's a constant, just convert it to an offset and remove the variable.
|
||||
// If we've been called recursively, the Offset bit width will be greater
|
||||
// than the constant's (the Offset's always as wide as the outermost call),
|
||||
// so we'll zext here and process any extension in the isa<SExtInst> &
|
||||
// isa<ZExtInst> cases below.
|
||||
|
@ -205,8 +205,8 @@ static bool isObjectSize(const Value *V, uint64_t Size, const DataLayout &DL,
|
|||
if (const BinaryOperator *BOp = dyn_cast<BinaryOperator>(V)) {
|
||||
if (ConstantInt *RHSC = dyn_cast<ConstantInt>(BOp->getOperand(1))) {
|
||||
|
||||
// If we've been called recursively then Offset and Scale will be wider
|
||||
// that the BOp operands. We'll always zext it here as we'll process sign
|
||||
// If we've been called recursively, then Offset and Scale will be wider
|
||||
// than the BOp operands. We'll always zext it here as we'll process sign
|
||||
// extensions below (see the isa<SExtInst> / isa<ZExtInst> cases).
|
||||
APInt RHS = RHSC->getValue().zextOrSelf(Offset.getBitWidth());
|
||||
|
||||
|
@ -939,7 +939,7 @@ AliasResult BasicAAResult::aliasGEP(const GEPOperator *GEP1, uint64_t V1Size,
|
|||
GEP1MaxLookupReached, DL, &AC, DT);
|
||||
// DecomposeGEPExpression and GetUnderlyingObject should return the
|
||||
// same result except when DecomposeGEPExpression has no DataLayout.
|
||||
// FIXME: They always have a DataLayout so this should become an
|
||||
// FIXME: They always have a DataLayout, so this should become an
|
||||
// assert.
|
||||
if (GEP1BasePtr != UnderlyingV1 || GEP2BasePtr != UnderlyingV2) {
|
||||
return MayAlias;
|
||||
|
@ -977,7 +977,7 @@ AliasResult BasicAAResult::aliasGEP(const GEPOperator *GEP1, uint64_t V1Size,
|
|||
|
||||
// DecomposeGEPExpression and GetUnderlyingObject should return the
|
||||
// same result except when DecomposeGEPExpression has no DataLayout.
|
||||
// FIXME: They always have a DataLayout so this should become an assert.
|
||||
// FIXME: They always have a DataLayout, so this should become an assert.
|
||||
if (GEP1BasePtr != UnderlyingV1 || GEP2BasePtr != UnderlyingV2) {
|
||||
return MayAlias;
|
||||
}
|
||||
|
@ -992,7 +992,7 @@ AliasResult BasicAAResult::aliasGEP(const GEPOperator *GEP1, uint64_t V1Size,
|
|||
return R;
|
||||
}
|
||||
|
||||
// If the max search depth is reached the result is undefined
|
||||
// If the max search depth is reached, the result is undefined
|
||||
if (GEP2MaxLookupReached || GEP1MaxLookupReached)
|
||||
return MayAlias;
|
||||
|
||||
|
@ -1027,7 +1027,7 @@ AliasResult BasicAAResult::aliasGEP(const GEPOperator *GEP1, uint64_t V1Size,
|
|||
|
||||
// DecomposeGEPExpression and GetUnderlyingObject should return the
|
||||
// same result except when DecomposeGEPExpression has no DataLayout.
|
||||
// FIXME: They always have a DataLayout so this should become an assert.
|
||||
// FIXME: They always have a DataLayout, so this should become an assert.
|
||||
if (GEP1BasePtr != UnderlyingV1) {
|
||||
return MayAlias;
|
||||
}
|
||||
|
@ -1038,7 +1038,7 @@ AliasResult BasicAAResult::aliasGEP(const GEPOperator *GEP1, uint64_t V1Size,
|
|||
|
||||
// In the two GEP Case, if there is no difference in the offsets of the
|
||||
// computed pointers, the resultant pointers are a must alias. This
|
||||
// hapens when we have two lexically identical GEP's (for example).
|
||||
// happens when we have two lexically identical GEP's (for example).
|
||||
//
|
||||
// In the other case, if we have getelementptr <ptr>, 0, 0, 0, 0, ... and V2
|
||||
// must aliases the GEP, the end result is a must alias also.
|
||||
|
@ -1312,7 +1312,7 @@ AliasResult BasicAAResult::aliasCheck(const Value *V1, uint64_t V1Size,
|
|||
return NoAlias;
|
||||
|
||||
// Are we checking for alias of the same value?
|
||||
// Because we look 'through' phi nodes we could look at "Value" pointers from
|
||||
// Because we look 'through' phi nodes, we could look at "Value" pointers from
|
||||
// different iterations. We must therefore make sure that this is not the
|
||||
// case. The function isValueEqualInPotentialCycles ensures that this cannot
|
||||
// happen by looking at the visited phi nodes and making sure they cannot
|
||||
|
@ -1337,7 +1337,7 @@ AliasResult BasicAAResult::aliasCheck(const Value *V1, uint64_t V1Size,
|
|||
return NoAlias;
|
||||
|
||||
if (O1 != O2) {
|
||||
// If V1/V2 point to two different objects we know that we have no alias.
|
||||
// If V1/V2 point to two different objects, we know that we have no alias.
|
||||
if (isIdentifiedObject(O1) && isIdentifiedObject(O2))
|
||||
return NoAlias;
|
||||
|
||||
|
@ -1430,8 +1430,7 @@ AliasResult BasicAAResult::aliasCheck(const Value *V1, uint64_t V1Size,
|
|||
}
|
||||
|
||||
// If both pointers are pointing into the same object and one of them
|
||||
// accesses is accessing the entire object, then the accesses must
|
||||
// overlap in some way.
|
||||
// accesses the entire object, then the accesses must overlap in some way.
|
||||
if (O1 == O2)
|
||||
if ((V1Size != MemoryLocation::UnknownSize &&
|
||||
isObjectSize(O1, V1Size, DL, TLI)) ||
|
||||
|
|
Loading…
Reference in New Issue