[llvm] [VectorCombine] Fold chain of (scalar load)->ext->ext to load->ext. (PR #141109)
Simon Pilgrim via llvm-commits
llvm-commits at lists.llvm.org
Thu May 29 01:02:35 PDT 2025
================
@@ -2777,6 +2778,57 @@ bool VectorCombine::foldShuffleToIdentity(Instruction &I) {
return true;
}
+bool VectorCombine::foldShuffleExtExtracts(Instruction &I) {
+ // Try to fold vector zero- and sign-extends split across multiple operations
+ // into a single extend, removing redundant inserts and shuffles.
+
+ // Check if we have an extended shuffle that selects the first vector, which
+ // itself is another extend fed by a load.
+ Instruction *L;
+ if (!match(
+ &I,
+ m_OneUse(m_Shuffle(
+ m_OneUse(m_ZExtOrSExt(m_OneUse(m_BitCast(m_OneUse(m_InsertElt(
+ m_Value(), m_OneUse(m_Instruction(L)), m_SpecificInt(0))))))),
----------------
RKSimon wrote:
(side note) it's a pity we can't do this:
```
LoadInst *L;
m_Load(L)
```
https://github.com/llvm/llvm-project/pull/141109
More information about the llvm-commits
mailing list