[llvm] [VectorCombine] Combine extract/insert from vector (PR #115213)
Simon Pilgrim via llvm-commits
llvm-commits at lists.llvm.org
Fri Nov 8 02:59:31 PST 2024
================
@@ -2678,6 +2679,49 @@ bool VectorCombine::shrinkType(llvm::Instruction &I) {
return true;
}
+/// insert (DstVec, (extract SrcVec, ExtIdx), InsIdx) -->
+/// shuffle (DstVec, SrcVec, Mask)
+bool VectorCombine::foldInsExtVectorToShuffle(Instruction &I) {
+ Value *DstVec, *SrcVec;
+ uint64_t ExtIdx, InsIdx;
+ if (!match(&I, m_InsertElt(m_Value(DstVec),
+ m_OneUse(m_ExtractElt(m_Value(SrcVec),
----------------
RKSimon wrote:
We should be able to remove the m_OneUse if we can account for it in the NewCost below by adding the ExtractElementInst cost back if its has multiple uses.
https://github.com/llvm/llvm-project/pull/115213
More information about the llvm-commits
mailing list