diff options
author | Dan Gohman <gohman@apple.com> | 2010-07-07 14:30:04 +0000 |
---|---|---|
committer | Dan Gohman <gohman@apple.com> | 2010-07-07 14:30:04 +0000 |
commit | b8c86a010c2d958d6f655b0f66101d8964d7a0fc (patch) | |
tree | 4b0a6d77c02d735e4de112204bcfc4c7c507cf3c /lib/Analysis/BasicAliasAnalysis.cpp | |
parent | 9e86f4364b912ae743490ba01d6989acfd12c046 (diff) | |
download | external_llvm-b8c86a010c2d958d6f655b0f66101d8964d7a0fc.zip external_llvm-b8c86a010c2d958d6f655b0f66101d8964d7a0fc.tar.gz external_llvm-b8c86a010c2d958d6f655b0f66101d8964d7a0fc.tar.bz2 |
Minore code simplification.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@107777 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/BasicAliasAnalysis.cpp')
-rw-r--r-- | lib/Analysis/BasicAliasAnalysis.cpp | 32 |
1 files changed, 15 insertions, 17 deletions
diff --git a/lib/Analysis/BasicAliasAnalysis.cpp b/lib/Analysis/BasicAliasAnalysis.cpp index d3a67a8..4f53a6d 100644 --- a/lib/Analysis/BasicAliasAnalysis.cpp +++ b/lib/Analysis/BasicAliasAnalysis.cpp @@ -763,8 +763,22 @@ BasicAliasAnalysis::aliasCheck(const Value *V1, unsigned V1Size, if ((isa<ConstantPointerNull>(O2) && isKnownNonNull(O1)) || (isa<ConstantPointerNull>(O1) && isKnownNonNull(O2))) return NoAlias; - } + // If one pointer is the result of a call/invoke or load and the other is a + // non-escaping local object within the same function, then we know the + // object couldn't escape to a point where the call could return it. + // + // Note that if the pointers are in different functions, there are a + // variety of complications. A call with a nocapture argument may still + // temporary store the nocapture argument's value in a temporary memory + // location if that memory location doesn't escape. Or it may pass a + // nocapture value to other functions as long as they don't capture it. + if (isEscapeSource(O1) && isNonEscapingLocalObject(O2)) + return NoAlias; + if (isEscapeSource(O2) && isNonEscapingLocalObject(O1)) + return NoAlias; + } + // If the size of one access is larger than the entire object on the other // side, then we know such behavior is undefined and can assume no alias. if (TD) @@ -772,22 +786,6 @@ BasicAliasAnalysis::aliasCheck(const Value *V1, unsigned V1Size, (V2Size != ~0U && isObjectSmallerThan(O1, V2Size, *TD))) return NoAlias; - // If one pointer is the result of a call/invoke or load and the other is a - // non-escaping local object within the same function, then we know the - // object couldn't escape to a point where the call could return it. - // - // Note that if the pointers are in different functions, there are a - // variety of complications. A call with a nocapture argument may still - // temporary store the nocapture argument's value in a temporary memory - // location if that memory location doesn't escape. Or it may pass a - // nocapture value to other functions as long as they don't capture it. - if (O1 != O2) { - if (isEscapeSource(O1) && isNonEscapingLocalObject(O2)) - return NoAlias; - if (isEscapeSource(O2) && isNonEscapingLocalObject(O1)) - return NoAlias; - } - // FIXME: This isn't aggressively handling alias(GEP, PHI) for example: if the // GEP can't simplify, we don't even look at the PHI cases. if (!isa<GEPOperator>(V1) && isa<GEPOperator>(V2)) { |