[llvm] [DirectX] Scalarize `extractelement` and `insertelement` with dynamic indices (PR #141676)
Deric C. via llvm-commits
llvm-commits at lists.llvm.org
Thu Jun 19 11:53:03 PDT 2025
================
@@ -173,6 +183,125 @@ bool DataScalarizerVisitor::visitStoreInst(StoreInst &SI) {
return false;
}
+DataScalarizerVisitor::AllocaAndGEPs
+DataScalarizerVisitor::createArrayFromVector(IRBuilder<> &Builder, Value *Vec,
+ const Twine &Name = "") {
+ // If there is already an alloca for this vector, return it
+ auto VA = VectorAllocaMap.find(Vec);
+ if (VA != VectorAllocaMap.end())
+ return VA->second;
+
+ auto InsertPoint = Builder.GetInsertPoint();
+
+ // Allocate the array to hold the vector elements
+ Builder.SetInsertPointPastAllocas(Builder.GetInsertBlock()->getParent());
+ Type *ArrTy = equivalentArrayTypeFromVector(Vec->getType());
+ AllocaInst *ArrAlloca =
+ Builder.CreateAlloca(ArrTy, nullptr, Name + ".alloca");
+ const uint64_t ArrNumElems = ArrTy->getArrayNumElements();
----------------
Icohedron wrote:
It is not certain whether or not HLSL will have large vectors before or after dynamic vector indexing is natively supported, so this assert may not necessarily be correct in the future.
https://github.com/llvm/llvm-project/pull/141676
More information about the llvm-commits
mailing list