[llvm] [TTI] Add getPointerInfos/getPointerInfo query for target address spaces (PR #213311)

via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 31 10:12:26 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/unittests/Analysis/TargetTransformInfoTest.cpp llvm/include/llvm/Analysis/TargetTransformInfo.h llvm/include/llvm/Analysis/TargetTransformInfoImpl.h llvm/lib/Analysis/TargetTransformInfo.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/include/llvm/Analysis/TargetTransformInfoImpl.h b/llvm/include/llvm/Analysis/TargetTransformInfoImpl.h
index ef6d7a635..6a94f7afb 100644
--- a/llvm/include/llvm/Analysis/TargetTransformInfoImpl.h
+++ b/llvm/include/llvm/Analysis/TargetTransformInfoImpl.h
@@ -152,10 +152,10 @@ public:
     // Targets only need to override getPointerInfos(); this searches the list
     // they report, which is sorted by address space number.
     SmallVector<TTI::PointerInfo, 8> Infos = getPointerInfos();
-    const auto *I = lower_bound(Infos, AS, [](const TTI::PointerInfo &PI,
-                                              unsigned AS) {
-      return PI.AddrSpace < AS;
-    });
+    const auto *I =
+        lower_bound(Infos, AS, [](const TTI::PointerInfo &PI, unsigned AS) {
+          return PI.AddrSpace < AS;
+        });
     if (I == Infos.end() || I->AddrSpace != AS)
       return std::nullopt;
     return *I;
diff --git a/llvm/unittests/Analysis/TargetTransformInfoTest.cpp b/llvm/unittests/Analysis/TargetTransformInfoTest.cpp
index 280f74599..e4e9469a6 100644
--- a/llvm/unittests/Analysis/TargetTransformInfoTest.cpp
+++ b/llvm/unittests/Analysis/TargetTransformInfoTest.cpp
@@ -19,7 +19,8 @@ namespace {
 // A target that describes some of its address spaces, but not all of them.
 class FakeTTIImpl : public TargetTransformInfoImplBase {
 public:
-  explicit FakeTTIImpl(const DataLayout &DL) : TargetTransformInfoImplBase(DL) {}
+  explicit FakeTTIImpl(const DataLayout &DL)
+      : TargetTransformInfoImplBase(DL) {}
 
   SmallVector<TTI::PointerInfo, 8> getPointerInfos() const override {
     return {TTI::PointerInfo{1, "global"}, TTI::PointerInfo{3, "local"},

``````````

</details>


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


More information about the llvm-commits mailing list