[llvm] [DirectX] Bug fix for Data Scalarization crash (PR #118426)

via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 18 11:16:57 PST 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 9919295cfd05222159246d7448ec42392e98fbf2 aefade22fda293f319331c0e8eea78a7b0ccd30b --extensions cpp -- llvm/lib/Target/DirectX/DXILDataScalarization.cpp llvm/lib/Target/DirectX/DXILFlattenArrays.cpp
``````````

</details>

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

``````````diff
diff --git a/llvm/lib/Target/DirectX/DXILDataScalarization.cpp b/llvm/lib/Target/DirectX/DXILDataScalarization.cpp
index af08fa08b2..e6fe74891f 100644
--- a/llvm/lib/Target/DirectX/DXILDataScalarization.cpp
+++ b/llvm/lib/Target/DirectX/DXILDataScalarization.cpp
@@ -133,7 +133,7 @@ bool DataScalarizerVisitor::visitStoreInst(StoreInst &SI) {
 }
 
 bool DataScalarizerVisitor::visitGetElementPtrInst(GetElementPtrInst &GEPI) {
-  
+
   unsigned NumOperands = GEPI.getNumOperands();
   GlobalVariable *NewGlobal = nullptr;
   for (unsigned I = 0; I < NumOperands; ++I) {
@@ -150,8 +150,9 @@ bool DataScalarizerVisitor::visitGetElementPtrInst(GetElementPtrInst &GEPI) {
   for (auto &Index : GEPI.indices())
     Indices.push_back(Index);
 
-  Value *NewGEP = Builder.CreateGEP(NewGlobal->getValueType(), NewGlobal, Indices,
-                           GEPI.getName(), GEPI.getNoWrapFlags());
+  Value *NewGEP =
+      Builder.CreateGEP(NewGlobal->getValueType(), NewGlobal, Indices,
+                        GEPI.getName(), GEPI.getNoWrapFlags());
   GEPI.replaceAllUsesWith(NewGEP);
   GEPI.eraseFromParent();
   return true;

``````````

</details>


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


More information about the llvm-commits mailing list