[clang] [llvm] [LV][LAA] Vectorize math lib calls with mem write-only attribute (PR #78432)

Paschalis Mpeis via cfe-commits cfe-commits at lists.llvm.org
Fri Jan 19 02:30:42 PST 2024


================
@@ -2274,6 +2274,26 @@ bool LoopAccessInfo::canAnalyzeLoop() {
   return true;
 }
 
+/// Returns whether \p I is a known math library call that has attribute
+/// 'memory(argmem: write)' set.
+static bool isMathLibCallMemWriteOnly(const TargetLibraryInfo *TLI,
+                                      const Instruction &I) {
+  auto *Call = dyn_cast<CallInst>(&I);
+  if (!Call)
+    return false;
+
+  Function *F = Call->getCalledFunction();
+  if (!F->hasFnAttribute(Attribute::AttrKind::Memory))
+    return false;
+
+  auto ME = F->getFnAttribute(Attribute::AttrKind::Memory).getMemoryEffects();
----------------
paschalis-mpeis wrote:

Good suggestion thanks, latest commit applies this.

https://github.com/llvm/llvm-project/pull/78432


More information about the cfe-commits mailing list