[llvm] [X86] combineTargetShuffle - remove redundant INSERTPS demanded mask fold (PR #217576)

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 20 03:28:36 PDT 2026


https://github.com/RKSimon created https://github.com/llvm/llvm-project/pull/217576

This is handled more generally in SimplifyDemandedVectorEltsForTargetNode

>From 97ab9c491c9f5bad43ed004a7e40dd1f42abfa25 Mon Sep 17 00:00:00 2001
From: Simon Pilgrim <llvm-dev at redking.me.uk>
Date: Thu, 20 Aug 2026 10:50:44 +0100
Subject: [PATCH] [X86] combineTargetShuffle - remove redundant INSERTPS
 demanded mask fold

This is handled more generally in SimplifyDemandedVectorEltsForTargetNode
---
 llvm/lib/Target/X86/X86ISelLowering.cpp | 10 ----------
 1 file changed, 10 deletions(-)

diff --git a/llvm/lib/Target/X86/X86ISelLowering.cpp b/llvm/lib/Target/X86/X86ISelLowering.cpp
index 6144e1f0bf99d..406761eec9721 100644
--- a/llvm/lib/Target/X86/X86ISelLowering.cpp
+++ b/llvm/lib/Target/X86/X86ISelLowering.cpp
@@ -43797,16 +43797,6 @@ static SDValue combineTargetShuffle(SDValue N, const SDLoc &DL,
     unsigned DstIdx = (InsertPSMask >> 4) & 0x3;
     unsigned ZeroMask = InsertPSMask & 0xF;
 
-    // If we zero out all elements from Op0 then we don't need to reference it.
-    if (((ZeroMask | (1u << DstIdx)) == 0xF) && !Op0.isUndef())
-      return DAG.getNode(X86ISD::INSERTPS, DL, VT, DAG.getUNDEF(VT), Op1,
-                         DAG.getTargetConstant(InsertPSMask, DL, MVT::i8));
-
-    // If we zero out the element from Op1 then we don't need to reference it.
-    if ((ZeroMask & (1u << DstIdx)) && !Op1.isUndef())
-      return DAG.getNode(X86ISD::INSERTPS, DL, VT, Op0, DAG.getUNDEF(VT),
-                         DAG.getTargetConstant(InsertPSMask, DL, MVT::i8));
-
     // Chained inserts of the same src - prefer splat + blend.
     // TODO: Splat isn't necessary if they insert into different v2f32 subs.
     if (Op0.getOpcode() == X86ISD::INSERTPS && Op0.getOperand(1) == Op1) {



More information about the llvm-commits mailing list