[llvm] [DirectX] Scalarize `extractelement` with dynamic index (PR #141676)
via llvm-commits
llvm-commits at lists.llvm.org
Tue May 27 14:49:32 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 HEAD~1 HEAD --extensions cpp -- llvm/lib/Target/DirectX/DXILDataScalarization.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 7bd0539c6..b0731f1cd 100644
--- a/llvm/lib/Target/DirectX/DXILDataScalarization.cpp
+++ b/llvm/lib/Target/DirectX/DXILDataScalarization.cpp
@@ -33,7 +33,8 @@ static Type *equivalentArrayTypeFromVector(Type *T) {
return ArrayType::get(VecTy->getElementType(),
dyn_cast<FixedVectorType>(VecTy)->getNumElements());
if (auto *ArrayTy = dyn_cast<ArrayType>(T)) {
- Type *NewElementType = equivalentArrayTypeFromVector(ArrayTy->getElementType());
+ Type *NewElementType =
+ equivalentArrayTypeFromVector(ArrayTy->getElementType());
return ArrayType::get(NewElementType, ArrayTy->getNumElements());
}
// If it's not a vector or array, return the original type.
@@ -182,7 +183,7 @@ bool DataScalarizerVisitor::visitExtractElementInst(ExtractElementInst &EEI) {
VectorType *VecTy = EEI.getVectorOperandType();
assert(VecTy->getElementCount().isFixed() &&
"Vector operand of ExtractElement must have a fixed size");
-
+
Type *ArrTy = equivalentArrayTypeFromVector(VecTy);
Value *ArrAlloca = Builder.CreateAlloca(ArrTy);
``````````
</details>
https://github.com/llvm/llvm-project/pull/141676
More information about the llvm-commits
mailing list