1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 03:02:36 +01:00

[Analysis] More LocationSize cleanup; NFC

Keeping these patches super small so they're easily post-commit
verifiable, as requested in D44748.

llvm-svn: 350008
This commit is contained in:
George Burgess IV 2018-12-22 18:23:21 +00:00
parent 654eb909d7
commit 283d33e193
3 changed files with 7 additions and 4 deletions

View File

@ -135,6 +135,9 @@ public:
return (Value & ImpreciseBit) == 0; return (Value & ImpreciseBit) == 0;
} }
// Convenience method to check if this LocationSize's value is 0.
bool isZero() const { return hasValue() && getValue() == 0; }
bool operator==(const LocationSize &Other) const { bool operator==(const LocationSize &Other) const {
return Value == Other.Value; return Value == Other.Value;
} }

View File

@ -1644,7 +1644,7 @@ AliasResult BasicAAResult::aliasCheck(const Value *V1, LocationSize V1Size,
const Value *O1, const Value *O2) { const Value *O1, const Value *O2) {
// If either of the memory references is empty, it doesn't matter what the // If either of the memory references is empty, it doesn't matter what the
// pointer values are. // pointer values are.
if (V1Size == 0 || V2Size == 0) if (V1Size.isZero() || V2Size.isZero())
return NoAlias; return NoAlias;
// Strip off any casts if they exist. // Strip off any casts if they exist.

View File

@ -27,7 +27,7 @@ AliasResult SCEVAAResult::alias(const MemoryLocation &LocA,
// If either of the memory references is empty, it doesn't matter what the // If either of the memory references is empty, it doesn't matter what the
// pointer values are. This allows the code below to ignore this special // pointer values are. This allows the code below to ignore this special
// case. // case.
if (LocA.Size == 0 || LocB.Size == 0) if (LocA.Size.isZero() || LocB.Size.isZero())
return NoAlias; return NoAlias;
// This is SCEVAAResult. Get the SCEVs! // This is SCEVAAResult. Get the SCEVs!
@ -82,10 +82,10 @@ AliasResult SCEVAAResult::alias(const MemoryLocation &LocA,
Value *BO = GetBaseValue(BS); Value *BO = GetBaseValue(BS);
if ((AO && AO != LocA.Ptr) || (BO && BO != LocB.Ptr)) if ((AO && AO != LocA.Ptr) || (BO && BO != LocB.Ptr))
if (alias(MemoryLocation(AO ? AO : LocA.Ptr, if (alias(MemoryLocation(AO ? AO : LocA.Ptr,
AO ? +MemoryLocation::UnknownSize : LocA.Size, AO ? LocationSize::unknown() : LocA.Size,
AO ? AAMDNodes() : LocA.AATags), AO ? AAMDNodes() : LocA.AATags),
MemoryLocation(BO ? BO : LocB.Ptr, MemoryLocation(BO ? BO : LocB.Ptr,
BO ? +MemoryLocation::UnknownSize : LocB.Size, BO ? LocationSize::unknown() : LocB.Size,
BO ? AAMDNodes() : LocB.AATags)) == NoAlias) BO ? AAMDNodes() : LocB.AATags)) == NoAlias)
return NoAlias; return NoAlias;