[llvm] [DirectX] Start the creation of a DXIL Instruction legalizer (PR #131221)

via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 13 14:32:23 PDT 2025


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 bd748b33958f8889d280afd4396b189edd0745bf 9c1d553f41883b40a7f5612decfd644481693645 --extensions h,cpp -- llvm/lib/Target/DirectX/DXILLegalizePass.cpp llvm/lib/Target/DirectX/DXILLegalizePass.h llvm/lib/Target/DirectX/DirectX.h llvm/lib/Target/DirectX/DirectXTargetMachine.cpp
``````````

</details>

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

``````````diff
diff --git a/llvm/lib/Target/DirectX/DXILLegalizePass.cpp b/llvm/lib/Target/DirectX/DXILLegalizePass.cpp
index 934a6e75ad..3db718d56a 100644
--- a/llvm/lib/Target/DirectX/DXILLegalizePass.cpp
+++ b/llvm/lib/Target/DirectX/DXILLegalizePass.cpp
@@ -89,8 +89,10 @@ static bool fixI8TruncUseChain(Instruction &I,
   return !ToRemove.empty();
 }
 
-static bool downcastI64toI32InsertExtractElements(
-    Instruction &I, std::stack<Instruction *> &ToRemove, std::map<Value *, Value *> &) {
+static bool
+downcastI64toI32InsertExtractElements(Instruction &I,
+                                      std::stack<Instruction *> &ToRemove,
+                                      std::map<Value *, Value *> &) {
 
   if (auto *Extract = dyn_cast<ExtractElementInst>(&I)) {
     Value *Idx = Extract->getIndexOperand();
@@ -100,8 +102,8 @@ static bool downcastI64toI32InsertExtractElements(
       int64_t IndexValue = CI->getSExtValue();
       auto *Idx32 =
           ConstantInt::get(Type::getInt32Ty(I.getContext()), IndexValue);
-      Value *NewExtract =
-          Builder.CreateExtractElement(Extract->getVectorOperand(), Idx32,Extract->getName());
+      Value *NewExtract = Builder.CreateExtractElement(
+          Extract->getVectorOperand(), Idx32, Extract->getName());
 
       Extract->replaceAllUsesWith(NewExtract);
       ToRemove.push(Extract);
@@ -117,7 +119,8 @@ static bool downcastI64toI32InsertExtractElements(
           ConstantInt::get(Type::getInt32Ty(I.getContext()), IndexValue);
       IRBuilder<> Builder(Insert);
       Value *Insert32Index = Builder.CreateInsertElement(
-          Insert->getOperand(0), Insert->getOperand(1), Idx32, Insert->getName());
+          Insert->getOperand(0), Insert->getOperand(1), Idx32,
+          Insert->getName());
 
       Insert->replaceAllUsesWith(Insert32Index);
       ToRemove.push(Insert);

``````````

</details>


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


More information about the llvm-commits mailing list