[llvm] [DirectX] Scalarize `extractelement` and `insertelement` with dynamic indices (PR #141676)
Farzon Lotfi via llvm-commits
llvm-commits at lists.llvm.org
Fri Jun 20 08:29:18 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);
----------------
farzonl wrote:
nit: i would prefer if the name would indicate we are using an iterator,
Also maybe we should do a more modern way like
```cpp
if (auto it = VectorAllocaMap.find(Vec); it != VectorAllocaMap.end()) {
return it->second;
}
```
or maybe something using contains `if (VectorAllocaMap.contains(Vec)) {`
https://github.com/llvm/llvm-project/pull/141676
More information about the llvm-commits
mailing list