[llvm] [DirectX] Scalarize `extractelement` and `insertelement` with dynamic indices (PR #141676)

Finn Plummer via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 6 15:54:37 PDT 2025


================
@@ -79,6 +79,16 @@ class DataScalarizerVisitor : public InstVisitor<DataScalarizerVisitor, bool> {
   friend bool findAndReplaceVectors(llvm::Module &M);
 
 private:
+  typedef std::pair<AllocaInst *, SmallVector<Value *, 4>> AllocaAndGEPs;
----------------
inbelic wrote:

This seems fine given the number of elements is currently capped at 4. But I think we should be very cautious if we consider any larger numbers, and that might very well be the case soon.

It think it is probably fine to just re-create the GEP's when we need them and let another optimization pass remove all of those instead of retaining them here.

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


More information about the llvm-commits mailing list