[llvm] [InstCombine] Pull extract through broadcast (PR #143380)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 9 07:02:56 PDT 2025


================
@@ -542,6 +542,12 @@ Instruction *InstCombinerImpl::visitExtractElementInst(ExtractElementInst &EI) {
         }
       }
     } else if (auto *SVI = dyn_cast<ShuffleVectorInst>(I)) {
+      // extractelt (shufflevector %v1, %v2, zeroinitializer) ->
+      // extractelt %v1, 0
+      if (isa<FixedVectorType>(SVI->getType()))
----------------
nikic wrote:

This is also correct for scalable vectors.

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


More information about the llvm-commits mailing list