@@ -101,7 +101,7 @@ bool BasicAAResult::invalidate(Function &Fn, const PreservedAnalyses &PA,
101
101
// ===----------------------------------------------------------------------===//
102
102
103
103
// / Returns the size of the object specified by V or UnknownSize if unknown.
104
- static uint64_t getObjectSize (const Value *V, const DataLayout &DL,
104
+ static LocationSize getObjectSize (const Value *V, const DataLayout &DL,
105
105
const TargetLibraryInfo &TLI,
106
106
bool NullIsValidLoc,
107
107
bool RoundToAlign = false ) {
@@ -110,13 +110,13 @@ static uint64_t getObjectSize(const Value *V, const DataLayout &DL,
110
110
Opts.RoundToAlign = RoundToAlign;
111
111
Opts.NullIsUnknownSize = NullIsValidLoc;
112
112
if (getObjectSize (V, Size, DL, &TLI, Opts))
113
- return Size;
114
- return MemoryLocation::UnknownSize;
113
+ return LocationSize ( Size, DL. getTypeAllocSize (V-> getType ()). isScalable ()) ;
114
+ return LocationSize ( MemoryLocation::UnknownSize) ;
115
115
}
116
116
117
117
// / Returns true if we can prove that the object specified by V is smaller than
118
118
// / Size.
119
- static bool isObjectSmallerThan (const Value *V, uint64_t Size,
119
+ static bool isObjectSmallerThan (const Value *V, LocationSize Size,
120
120
const DataLayout &DL,
121
121
const TargetLibraryInfo &TLI,
122
122
bool NullIsValidLoc) {
@@ -151,16 +151,20 @@ static bool isObjectSmallerThan(const Value *V, uint64_t Size,
151
151
152
152
// This function needs to use the aligned object size because we allow
153
153
// reads a bit past the end given sufficient alignment.
154
- uint64_t ObjectSize = getObjectSize (V, DL, TLI, NullIsValidLoc,
154
+ LocationSize ObjectSize = getObjectSize (V, DL, TLI, NullIsValidLoc,
155
155
/* RoundToAlign*/ true );
156
156
157
- return ObjectSize != MemoryLocation::UnknownSize && ObjectSize < Size;
157
+ // Bail on comparing V and Size if their scalability differs
158
+ if (ObjectSize.isScalable () != Size.isScalable ())
159
+ return false ;
160
+
161
+ return ObjectSize != MemoryLocation::UnknownSize && ObjectSize.getValue () < Size.getValue ();
158
162
}
159
163
160
164
// / Return the minimal extent from \p V to the end of the underlying object,
161
165
// / assuming the result is used in an aliasing query. E.g., we do use the query
162
166
// / location size and the fact that null pointers cannot alias here.
163
- static uint64_t getMinimalExtentFrom (const Value &V,
167
+ static LocationSize getMinimalExtentFrom (const Value &V,
164
168
const LocationSize &LocSize,
165
169
const DataLayout &DL,
166
170
bool NullIsValidLoc) {
@@ -176,14 +180,14 @@ static uint64_t getMinimalExtentFrom(const Value &V,
176
180
// accessed, thus valid.
177
181
if (LocSize.isPrecise ())
178
182
DerefBytes = std::max (DerefBytes, LocSize.getValue ());
179
- return DerefBytes;
183
+ return LocationSize ( DerefBytes, LocSize. isScalable ()) ;
180
184
}
181
185
182
186
// / Returns true if we can prove that the object specified by V has size Size.
183
187
static bool isObjectSize (const Value *V, uint64_t Size, const DataLayout &DL,
184
188
const TargetLibraryInfo &TLI, bool NullIsValidLoc) {
185
- uint64_t ObjectSize = getObjectSize (V, DL, TLI, NullIsValidLoc);
186
- return ObjectSize != MemoryLocation::UnknownSize && ObjectSize == Size;
189
+ LocationSize ObjectSize = getObjectSize (V, DL, TLI, NullIsValidLoc);
190
+ return ObjectSize != MemoryLocation::UnknownSize && ObjectSize. getValue () == Size;
187
191
}
188
192
189
193
// ===----------------------------------------------------------------------===//
@@ -1087,6 +1091,10 @@ AliasResult BasicAAResult::aliasGEP(
1087
1091
return BaseAlias;
1088
1092
}
1089
1093
1094
+ // Bail on analysing scalable LocationSize
1095
+ if (V1Size.isScalable () || V2Size.isScalable ())
1096
+ return AliasResult::MayAlias;
1097
+
1090
1098
// If there is a constant difference between the pointers, but the difference
1091
1099
// is less than the size of the associated memory object, then we know
1092
1100
// that the objects are partially overlapping. If the difference is
0 commit comments