@@ -178,7 +178,7 @@ ModRefInfo AAResults::getArgModRefInfo(const CallBase *Call, unsigned ArgIdx) {
178
178
ModRefInfo Result = ModRefInfo::ModRef;
179
179
180
180
for (const auto &AA : AAs) {
181
- Result = intersectModRef (Result, AA->getArgModRefInfo (Call, ArgIdx) );
181
+ Result &= AA->getArgModRefInfo (Call, ArgIdx);
182
182
183
183
// Early-exit the moment we reach the bottom of the lattice.
184
184
if (isNoModRef (Result))
@@ -226,7 +226,7 @@ ModRefInfo AAResults::getModRefInfo(const CallBase *Call,
226
226
ModRefInfo Result = ModRefInfo::ModRef;
227
227
228
228
for (const auto &AA : AAs) {
229
- Result = intersectModRef (Result, AA->getModRefInfo (Call, Loc, AAQI) );
229
+ Result &= AA->getModRefInfo (Call, Loc, AAQI);
230
230
231
231
// Early-exit the moment we reach the bottom of the lattice.
232
232
if (isNoModRef (Result))
@@ -240,9 +240,9 @@ ModRefInfo AAResults::getModRefInfo(const CallBase *Call,
240
240
return ModRefInfo::NoModRef;
241
241
242
242
if (onlyReadsMemory (MRB))
243
- Result = clearMod (Result) ;
243
+ Result &= ModRefInfo::Ref ;
244
244
else if (onlyWritesMemory (MRB))
245
- Result = clearRef (Result) ;
245
+ Result &= ModRefInfo::Mod ;
246
246
247
247
if (onlyAccessesArgPointees (MRB) || onlyAccessesInaccessibleOrArgMem (MRB)) {
248
248
ModRefInfo AllArgsMask = ModRefInfo::NoModRef;
@@ -255,23 +255,21 @@ ModRefInfo AAResults::getModRefInfo(const CallBase *Call,
255
255
MemoryLocation ArgLoc =
256
256
MemoryLocation::getForArgument (Call, ArgIdx, TLI);
257
257
AliasResult ArgAlias = alias (ArgLoc, Loc, AAQI);
258
- if (ArgAlias != AliasResult::NoAlias) {
259
- ModRefInfo ArgMask = getArgModRefInfo (Call, ArgIdx);
260
- AllArgsMask = unionModRef (AllArgsMask, ArgMask);
261
- }
258
+ if (ArgAlias != AliasResult::NoAlias)
259
+ AllArgsMask |= getArgModRefInfo (Call, ArgIdx);
262
260
}
263
261
}
264
262
// Return NoModRef if no alias found with any argument.
265
263
if (isNoModRef (AllArgsMask))
266
264
return ModRefInfo::NoModRef;
267
265
// Logical & between other AA analyses and argument analysis.
268
- Result = intersectModRef (Result, AllArgsMask) ;
266
+ Result &= AllArgsMask;
269
267
}
270
268
271
269
// If Loc is a constant memory location, the call definitely could not
272
270
// modify the memory location.
273
271
if (isModSet (Result) && pointsToConstantMemory (Loc, AAQI, /* OrLocal*/ false ))
274
- Result = clearMod (Result) ;
272
+ Result &= ModRefInfo::Ref ;
275
273
276
274
return Result;
277
275
}
@@ -287,7 +285,7 @@ ModRefInfo AAResults::getModRefInfo(const CallBase *Call1,
287
285
ModRefInfo Result = ModRefInfo::ModRef;
288
286
289
287
for (const auto &AA : AAs) {
290
- Result = intersectModRef (Result, AA->getModRefInfo (Call1, Call2, AAQI) );
288
+ Result &= AA->getModRefInfo (Call1, Call2, AAQI);
291
289
292
290
// Early-exit the moment we reach the bottom of the lattice.
293
291
if (isNoModRef (Result))
@@ -313,9 +311,9 @@ ModRefInfo AAResults::getModRefInfo(const CallBase *Call1,
313
311
// If Call1 only reads memory, the only dependence on Call2 can be
314
312
// from Call1 reading memory written by Call2.
315
313
if (onlyReadsMemory (Call1B))
316
- Result = clearMod (Result) ;
314
+ Result &= ModRefInfo::Ref ;
317
315
else if (onlyWritesMemory (Call1B))
318
- Result = clearRef (Result) ;
316
+ Result &= ModRefInfo::Mod ;
319
317
320
318
// If Call2 only access memory through arguments, accumulate the mod/ref
321
319
// information from Call1's references to the memory referenced by
@@ -346,10 +344,9 @@ ModRefInfo AAResults::getModRefInfo(const CallBase *Call1,
346
344
347
345
// ModRefC1 indicates what Call1 might do to Call2ArgLoc, and we use
348
346
// above ArgMask to update dependence info.
349
- ModRefInfo ModRefC1 = getModRefInfo (Call1, Call2ArgLoc, AAQI);
350
- ArgMask = intersectModRef (ArgMask, ModRefC1);
347
+ ArgMask &= getModRefInfo (Call1, Call2ArgLoc, AAQI);
351
348
352
- R = intersectModRef ( unionModRef (R, ArgMask), Result) ;
349
+ R = (R | ArgMask) & Result;
353
350
if (R == Result)
354
351
break ;
355
352
}
@@ -378,7 +375,7 @@ ModRefInfo AAResults::getModRefInfo(const CallBase *Call1,
378
375
ModRefInfo ModRefC2 = getModRefInfo (Call2, Call1ArgLoc, AAQI);
379
376
if ((isModSet (ArgModRefC1) && isModOrRefSet (ModRefC2)) ||
380
377
(isRefSet (ArgModRefC1) && isModSet (ModRefC2)))
381
- R = intersectModRef ( unionModRef (R, ArgModRefC1), Result) ;
378
+ R = (R | ArgModRefC1) & Result;
382
379
383
380
if (R == Result)
384
381
break ;
@@ -746,7 +743,7 @@ bool AAResults::canInstructionRangeModRef(const Instruction &I1,
746
743
++E; // Convert from inclusive to exclusive range.
747
744
748
745
for (; I != E; ++I) // Check every instruction in range
749
- if (isModOrRefSet (intersectModRef ( getModRefInfo (&*I, Loc), Mode) ))
746
+ if (isModOrRefSet (getModRefInfo (&*I, Loc) & Mode))
750
747
return true ;
751
748
return false ;
752
749
}
0 commit comments