[llvm] [LoopDataPrefetch] Add support for target-specific memory intrinsics (PR #207358)

via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 3 02:41:07 PDT 2026


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff origin/main HEAD --extensions cpp,h -- llvm/include/llvm/Analysis/TargetTransformInfo.h llvm/include/llvm/Analysis/TargetTransformInfoImpl.h llvm/include/llvm/CodeGen/BasicTTIImpl.h llvm/include/llvm/MC/MCSubtargetInfo.h llvm/lib/Analysis/TargetTransformInfo.cpp llvm/lib/MC/MCSubtargetInfo.cpp llvm/lib/Target/AArch64/AArch64Subtarget.h llvm/lib/Transforms/Scalar/LoopDataPrefetch.cpp --diff_from_common_commit
``````````

:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/llvm/lib/MC/MCSubtargetInfo.cpp b/llvm/lib/MC/MCSubtargetInfo.cpp
index 516e36a47..db937bc1b 100644
--- a/llvm/lib/MC/MCSubtargetInfo.cpp
+++ b/llvm/lib/MC/MCSubtargetInfo.cpp
@@ -499,9 +499,7 @@ bool MCSubtargetInfo::enableWritePrefetching() const {
   return false;
 }
 
-bool MCSubtargetInfo::enableTgtMemIntrinsicPrefetching() const {
-  return false;
-}
+bool MCSubtargetInfo::enableTgtMemIntrinsicPrefetching() const { return false; }
 
 unsigned MCSubtargetInfo::getMinPrefetchStride(unsigned NumMemAccesses,
                                                unsigned NumStridedMemAccesses,
diff --git a/llvm/lib/Target/AArch64/AArch64Subtarget.h b/llvm/lib/Target/AArch64/AArch64Subtarget.h
index 140aca576..710958645 100644
--- a/llvm/lib/Target/AArch64/AArch64Subtarget.h
+++ b/llvm/lib/Target/AArch64/AArch64Subtarget.h
@@ -287,9 +287,7 @@ public:
   unsigned getMaxPrefetchIterationsAhead() const override {
     return MaxPrefetchIterationsAhead;
   }
-  bool enableTgtMemIntrinsicPrefetching() const override {
-    return true;
-  }
+  bool enableTgtMemIntrinsicPrefetching() const override { return true; }
   Align getPrefFunctionAlignment() const {
     return PrefFunctionAlignment;
   }
diff --git a/llvm/lib/Transforms/Scalar/LoopDataPrefetch.cpp b/llvm/lib/Transforms/Scalar/LoopDataPrefetch.cpp
index cc8a961d9..cabe63ba7 100644
--- a/llvm/lib/Transforms/Scalar/LoopDataPrefetch.cpp
+++ b/llvm/lib/Transforms/Scalar/LoopDataPrefetch.cpp
@@ -40,9 +40,8 @@ static cl::opt<bool>
 PrefetchWrites("loop-prefetch-writes", cl::Hidden, cl::init(false),
                cl::desc("Prefetch write addresses"));
 
-static cl::opt<bool>
-PrefetchTgtMemIntrinsics("loop-prefetch-tgt-mem-intrinsics", cl::Hidden,
-    cl::init(false),
+static cl::opt<bool> PrefetchTgtMemIntrinsics(
+    "loop-prefetch-tgt-mem-intrinsics", cl::Hidden, cl::init(false),
     cl::desc("Prefetch addresses from target-specific memory intrinsics"));
 
 static cl::opt<unsigned>
@@ -358,7 +357,8 @@ bool LoopDataPrefetch::runOnLoop(Loop *L) {
           continue;
         MemI = IntrI;
         PtrValue = IntrInfo.PtrVal;
-      } else continue;
+      } else
+        continue;
 
       unsigned PtrAddrSpace = PtrValue->getType()->getPointerAddressSpace();
       if (!TTI->shouldPrefetchAddressSpace(PtrAddrSpace))

``````````

</details>


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


More information about the llvm-commits mailing list