[llvm] [DAG] Combine `store + vselect` to `masked_store` (PR #145176)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 26 22:47:43 PDT 2025


================
@@ -22451,12 +22452,81 @@ SDValue DAGCombiner::visitATOMIC_STORE(SDNode *N) {
   return SDValue();
 }
 
+static SDValue foldToMaskedStore(StoreSDNode *Store, SelectionDAG &DAG,
+                                 const SDLoc &Dl) {
+  using namespace llvm::SDPatternMatch;
+
+  if (!Store->isSimple() || Store->isTruncatingStore())
+    return SDValue();
+
+  SDValue StoredVal = Store->getValue();
+  SDValue StorePtr = Store->getBasePtr();
+  SDValue StoreOffset = Store->getOffset();
+  EVT VT = Store->getMemoryVT();
+  const TargetLowering &TLI = DAG.getTargetLoweringInfo();
+
+  if (!TLI.isTypeLegal(VT) || !TLI.isOperationLegalOrCustom(ISD::MSTORE, VT))
+    return SDValue();
----------------
arsenm wrote:

This is going to be another case where we have inadequate legalization information for the store, this needs an alignment and address space at least t

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


More information about the llvm-commits mailing list