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

Abhishek Kaushik via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 23 03:16:34 PDT 2025


================
@@ -53403,6 +53404,76 @@ static SDValue combineMaskedStore(SDNode *N, SelectionDAG &DAG,
   return SDValue();
 }
 
+static SDValue foldToMaskedStore(StoreSDNode *Store, SelectionDAG &DAG,
+                                 const SDLoc &Dl,
+                                 const X86Subtarget &Subtarget) {
----------------
abhishek-kaushik22 wrote:

Sorry, I was thinking that this would translate to a mstore in initial DAG and then custom lowered 
```
define void @foo(<8 x i32> %x, ptr %ptr1, <8 x i1> %cmp) {
  tail call void @llvm.masked.store.v8i32.p0(<8 x i32> %x, ptr %ptr1, i32 32, <8 x i1> %cmp)
  ret void
}
```

Makes sense to put this in DAGCombiner, but I don't have any way to test on non-x86 platforms

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


More information about the llvm-commits mailing list