[llvm] 8e5f57d - [BasicAA] Remove redundant libcall handling

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 27 03:01:41 PDT 2022


Author: Nikita Popov
Date: 2022-10-27T12:01:33+02:00
New Revision: 8e5f57d738d919ff7730036cc0628b533ece7ca8

URL: https://github.com/llvm/llvm-project/commit/8e5f57d738d919ff7730036cc0628b533ece7ca8
DIFF: https://github.com/llvm/llvm-project/commit/8e5f57d738d919ff7730036cc0628b533ece7ca8.diff

LOG: [BasicAA] Remove redundant libcall handling

The writeonly attribute for memset_pattern16 (and other referenced
libcalls) is being added by InferFunctionAttrs nowadays. No need
to special-case it here.

Added: 
    

Modified: 
    llvm/lib/Analysis/BasicAliasAnalysis.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Analysis/BasicAliasAnalysis.cpp b/llvm/lib/Analysis/BasicAliasAnalysis.cpp
index ed800c39eb70..fe0426a0955b 100644
--- a/llvm/lib/Analysis/BasicAliasAnalysis.cpp
+++ b/llvm/lib/Analysis/BasicAliasAnalysis.cpp
@@ -789,36 +789,9 @@ MemoryEffects BasicAAResult::getMemoryEffects(const Function *F) {
   return getMemoryEffectsFromAttrs(F->getAttributes().getFnAttrs());
 }
 
-/// Returns true if this is a writeonly (i.e Mod only) parameter.
-static bool isWriteOnlyParam(const CallBase *Call, unsigned ArgIdx,
-                             const TargetLibraryInfo &TLI) {
-  if (Call->paramHasAttr(ArgIdx, Attribute::WriteOnly))
-    return true;
-
-  // We can bound the aliasing properties of memset_pattern16 just as we can
-  // for memcpy/memset.  This is particularly important because the
-  // LoopIdiomRecognizer likes to turn loops into calls to memset_pattern16
-  // whenever possible.
-  // FIXME Consider handling this in InferFunctionAttr.cpp together with other
-  // attributes.
-  LibFunc F;
-  if (Call->getCalledFunction() &&
-      TLI.getLibFunc(*Call->getCalledFunction(), F) &&
-      F == LibFunc_memset_pattern16 && TLI.has(F))
-    if (ArgIdx == 0)
-      return true;
-
-  // TODO: memset_pattern4, memset_pattern8
-  // TODO: _chk variants
-  // TODO: strcmp, strcpy
-
-  return false;
-}
-
 ModRefInfo BasicAAResult::getArgModRefInfo(const CallBase *Call,
                                            unsigned ArgIdx) {
-  // Checking for known builtin intrinsics and target library functions.
-  if (isWriteOnlyParam(Call, ArgIdx, TLI))
+  if (Call->paramHasAttr(ArgIdx, Attribute::WriteOnly))
     return ModRefInfo::Mod;
 
   if (Call->paramHasAttr(ArgIdx, Attribute::ReadOnly))


        


More information about the llvm-commits mailing list