From 32017d5efec598478a75c2c0027f64b71bd2ea4e Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Thu, 21 Jul 2022 09:53:26 +0200 Subject: [PATCH] [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 --- llvm/lib/Transforms/IPO/AttributorAttributes.cpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/llvm/lib/Transforms/IPO/AttributorAttributes.cpp b/llvm/lib/Transforms/IPO/AttributorAttributes.cpp index 05e074832bed..eda0899aacc5 100644 --- a/llvm/lib/Transforms/IPO/AttributorAttributes.cpp +++ b/llvm/lib/Transforms/IPO/AttributorAttributes.cpp @@ -4845,11 +4845,8 @@ struct AAInstanceInfoImpl : public AAInstanceInfo { auto EquivalentUseCB = [&](const Use &OldU, const Use &NewU) { if (auto *SI = dyn_cast(OldU.getUser())) { auto *Ptr = SI->getPointerOperand()->stripPointerCasts(); - if (isa(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(Ptr) || isNoAliasCall(Ptr)) && + AA::isDynamicallyUnique(A, *this, *Ptr)) return true; } return false;