[Attributor] Check for noalias call in AAInstanceInfo

The relevant property of allocation functions of interest here is
their uniqueness (in the sense of disjoint provenance), which is
encoded by the noalias return attribute.

Differential Revision: https://reviews.llvm.org/D130225
This commit is contained in:
Nikita Popov 2022-07-21 09:53:26 +02:00
parent 3bba12a81e
commit 32017d5efe

View File

@ -4845,11 +4845,8 @@ struct AAInstanceInfoImpl : public AAInstanceInfo {
auto EquivalentUseCB = [&](const Use &OldU, const Use &NewU) {
if (auto *SI = dyn_cast<StoreInst>(OldU.getUser())) {
auto *Ptr = SI->getPointerOperand()->stripPointerCasts();
if (isa<AllocaInst>(Ptr) && AA::isDynamicallyUnique(A, *this, *Ptr))
return true;
auto *TLI = A.getInfoCache().getTargetLibraryInfoForFunction(
*SI->getFunction());
if (isAllocationFn(Ptr, TLI) && AA::isDynamicallyUnique(A, *this, *Ptr))
if ((isa<AllocaInst>(Ptr) || isNoAliasCall(Ptr)) &&
AA::isDynamicallyUnique(A, *this, *Ptr))
return true;
}
return false;