[AliasAnalysis] Misc fixes for checking aliasing with scalable types.
[lldb.git] / llvm / include / llvm / Analysis / MemoryLocation.h
index dd576e0..4460411 100644 (file)
@@ -89,6 +89,11 @@ public:
       : Value(Raw > MaxValue ? Unknown : Raw) {}
 
   static LocationSize precise(uint64_t Value) { return LocationSize(Value); }
+  static LocationSize precise(TypeSize Value) {
+    if (Value.isScalable())
+      return unknown();
+    return precise(Value.getFixedSize());
+  }
 
   static LocationSize upperBound(uint64_t Value) {
     // You can't go lower than 0, so give a precise result.
@@ -98,6 +103,11 @@ public:
       return unknown();
     return LocationSize(Value | ImpreciseBit, Direct);
   }
+  static LocationSize upperBound(TypeSize Value) {
+    if (Value.isScalable())
+      return unknown();
+    return upperBound(Value.getFixedSize());
+  }
 
   constexpr static LocationSize unknown() {
     return LocationSize(Unknown, Direct);