diff options
author | Michael Kuperstein <mkuper@google.com> | 2016-05-20 20:26:50 +0000 |
---|---|---|
committer | Michael Kuperstein <mkuper@google.com> | 2016-05-20 20:26:50 +0000 |
commit | f45e5b58b8407a02f87e50e6c77137a273ada8ba (patch) | |
tree | 3961137997eed7ad3f5e81041f0224ca0aa585ec /llvm/lib/Analysis/BasicAliasAnalysis.cpp | |
parent | 6b58c4723a94c8e89cb91e8e83d9fb8047fee329 (diff) | |
download | llvm-f45e5b58b8407a02f87e50e6c77137a273ada8ba.zip llvm-f45e5b58b8407a02f87e50e6c77137a273ada8ba.tar.gz llvm-f45e5b58b8407a02f87e50e6c77137a273ada8ba.tar.bz2 |
[BasicAA] Turn DecomposeGEPExpression runtime checks into asserts.
When it has a DataLayout, DecomposeGEPExpression() should return the same object
as GetUnderlyingObject(). Per the FIXME, it currently always has a DL, so the
runtime check is redundant and can become an assert.
llvm-svn: 270268
Diffstat (limited to 'llvm/lib/Analysis/BasicAliasAnalysis.cpp')
-rw-r--r-- | llvm/lib/Analysis/BasicAliasAnalysis.cpp | 29 |
1 files changed, 12 insertions, 17 deletions
diff --git a/llvm/lib/Analysis/BasicAliasAnalysis.cpp b/llvm/lib/Analysis/BasicAliasAnalysis.cpp index be4e8e9..876ffe0 100644 --- a/llvm/lib/Analysis/BasicAliasAnalysis.cpp +++ b/llvm/lib/Analysis/BasicAliasAnalysis.cpp @@ -991,13 +991,10 @@ AliasResult BasicAAResult::aliasGEP(const GEPOperator *GEP1, uint64_t V1Size, const Value *GEP1BasePtr = DecomposeGEPExpression(GEP1, GEP1BaseOffset, GEP1VariableIndices, 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 - // assert. - if (GEP1BasePtr != UnderlyingV1 || GEP2BasePtr != UnderlyingV2) { - return MayAlias; - } + + assert(GEP1BasePtr == UnderlyingV1 && GEP2BasePtr == UnderlyingV2 && + "DecomposeGEPExpression returned a result different from " + "GetUnderlyingObject"); // If the max search depth is reached the result is undefined if (GEP2MaxLookupReached || GEP1MaxLookupReached) return MayAlias; @@ -1029,12 +1026,10 @@ AliasResult BasicAAResult::aliasGEP(const GEPOperator *GEP1, uint64_t V1Size, DecomposeGEPExpression(GEP2, GEP2BaseOffset, GEP2VariableIndices, GEP2MaxLookupReached, 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 assert. - if (GEP1BasePtr != UnderlyingV1 || GEP2BasePtr != UnderlyingV2) { - return MayAlias; - } + assert(GEP1BasePtr == UnderlyingV1 && GEP2BasePtr == UnderlyingV2 && + "DecomposeGEPExpression returned a result different from " + "GetUnderlyingObject"); + // If we know the two GEPs are based off of the exact same pointer (and not // just the same underlying object), see if that tells us anything about @@ -1081,10 +1076,10 @@ 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. - if (GEP1BasePtr != UnderlyingV1) { - return MayAlias; - } + assert(GEP1BasePtr == UnderlyingV1 && + "DecomposeGEPExpression returned a result different from " + "GetUnderlyingObject"); + // If the max search depth is reached the result is undefined if (GEP1MaxLookupReached) return MayAlias; |