]> granicus.if.org Git - llvm/commitdiff
[Analysis] More LocationSize cleanup; NFC
authorGeorge Burgess IV <george.burgess.iv@gmail.com>
Sat, 22 Dec 2018 18:23:21 +0000 (18:23 +0000)
committerGeorge Burgess IV <george.burgess.iv@gmail.com>
Sat, 22 Dec 2018 18:23:21 +0000 (18:23 +0000)
Keeping these patches super small so they're easily post-commit
verifiable, as requested in D44748.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@350008 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/Analysis/MemoryLocation.h
lib/Analysis/BasicAliasAnalysis.cpp
lib/Analysis/ScalarEvolutionAliasAnalysis.cpp

index cf839c5a1eb8764cd1ac8cafcf52d45e62f846e1..83d4186a00095134392373ce3dd0ae2309c51765 100644 (file)
@@ -135,6 +135,9 @@ public:
     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 {
     return Value == Other.Value;
   }
index 5bb85b49cb1be8c35c38e2bddb5a6ec79e822263..a425d93e0313333e69a67b2543075d5e76b5c3b4 100644 (file)
@@ -1644,7 +1644,7 @@ AliasResult BasicAAResult::aliasCheck(const Value *V1, LocationSize V1Size,
                                       const Value *O1, const Value *O2) {
   // If either of the memory references is empty, it doesn't matter what the
   // pointer values are.
-  if (V1Size == 0 || V2Size == 0)
+  if (V1Size.isZero() || V2Size.isZero())
     return NoAlias;
 
   // Strip off any casts if they exist.
index 61f625477ca6bf32b3070714208130a4d4c9446f..289d4f8ae49ae21d00aa2e0b07b8985245ca0cb5 100644 (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
   // pointer values are. This allows the code below to ignore this special
   // case.
-  if (LocA.Size == 0 || LocB.Size == 0)
+  if (LocA.Size.isZero() || LocB.Size.isZero())
     return NoAlias;
 
   // This is SCEVAAResult. Get the SCEVs!
@@ -82,10 +82,10 @@ AliasResult SCEVAAResult::alias(const MemoryLocation &LocA,
   Value *BO = GetBaseValue(BS);
   if ((AO && AO != LocA.Ptr) || (BO && BO != LocB.Ptr))
     if (alias(MemoryLocation(AO ? AO : LocA.Ptr,
-                             AO ? +MemoryLocation::UnknownSize : LocA.Size,
+                             AO ? LocationSize::unknown() : LocA.Size,
                              AO ? AAMDNodes() : LocA.AATags),
               MemoryLocation(BO ? BO : LocB.Ptr,
-                             BO ? +MemoryLocation::UnknownSize : LocB.Size,
+                             BO ? LocationSize::unknown() : LocB.Size,
                              BO ? AAMDNodes() : LocB.AATags)) == NoAlias)
       return NoAlias;