[llvm] [DirectX] Scalarize `extractelement` with dynamic index (PR #141676)

Deric C. via llvm-commits llvm-commits at lists.llvm.org
Tue May 27 14:49:56 PDT 2025


================
@@ -173,6 +171,38 @@ bool DataScalarizerVisitor::visitStoreInst(StoreInst &SI) {
   return false;
 }
 
+bool DataScalarizerVisitor::visitExtractElementInst(ExtractElementInst &EEI) {
----------------
Icohedron wrote:

```suggestion
bool DataScalarizerVisitor::visitExtractElementInst(ExtractElementInst &EEI) {
  // Shader Model 6.9 and above supports dynamic vector indexing and therefore
  // does not need to be scalarized
  VersionTuple ShaderModelVersion =
      EEI.getModule()->getTargetTriple().getOSVersion();
  if (ShaderModelVersion >= VersionTuple(6, 9))
    return false;
    
```
Should I add a shader model check here for 6.9? SM 6.9 isn't currently a supported target. Perhaps a TODO comment instead?

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


More information about the llvm-commits mailing list