[llvm] [NVPTX] Check Before inserting AddrSpaceCastInst in NVPTXLoweringAlloca (PR #106127)

via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 26 13:13:14 PDT 2024


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 34dee0a96105d6aeb8b386efbbbfe437ab1be02e 0c9a46d59bf1df9798e2e868344db3a93ae83d49 --extensions cpp -- llvm/lib/Target/NVPTX/NVPTXLowerAlloca.cpp
``````````

</details>

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

``````````diff
diff --git a/llvm/lib/Target/NVPTX/NVPTXLowerAlloca.cpp b/llvm/lib/Target/NVPTX/NVPTXLowerAlloca.cpp
index 62b789c008..230f373725 100644
--- a/llvm/lib/Target/NVPTX/NVPTXLowerAlloca.cpp
+++ b/llvm/lib/Target/NVPTX/NVPTXLowerAlloca.cpp
@@ -72,10 +72,11 @@ bool NVPTXLowerAlloca::runOnFunction(Function &F) {
         Changed = true;
         auto ETy = allocaInst->getAllocatedType();
         auto LocalAddrTy = PointerType::get(ETy, ADDRESS_SPACE_LOCAL);
-        PointerType *allocInstPtrTy = dyn_cast_or_null<PointerType>(allocaInst->getType()->getScalarType());
+        PointerType *allocInstPtrTy = dyn_cast_or_null<PointerType>(
+            allocaInst->getType()->getScalarType());
         assert(allocInstPtrTy && "AllocInst scalar type is not a PointerType.");
-        Instruction* NewASCToGeneric = allocaInst;
-        if(allocInstPtrTy->getAddressSpace() != ADDRESS_SPACE_LOCAL) {
+        Instruction *NewASCToGeneric = allocaInst;
+        if (allocInstPtrTy->getAddressSpace() != ADDRESS_SPACE_LOCAL) {
           // Only insert a new AddrSpaceCastInst if
           // allocaInst is not already in ADDRESS_SPACE_LOCAL.
           auto NewASCToLocal =

``````````

</details>


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


More information about the llvm-commits mailing list