Skip to content

Commit e30371d

Browse files
committed
[DAGCombiner] Teach visitMSTORE to replace an all ones mask with an unmasked store.
Similar to what done in D87788 for MLOAD. Again I've skipped indexed, truncating, and compressing stores.
1 parent f70baaf commit e30371d

File tree

2 files changed

+214
-138
lines changed

2 files changed

+214
-138
lines changed

llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9244,6 +9244,14 @@ SDValue DAGCombiner::visitMSTORE(SDNode *N) {
92449244
if (ISD::isBuildVectorAllZeros(Mask.getNode()))
92459245
return Chain;
92469246

9247+
// If this is a masked load with an all ones mask, we can use a unmasked load.
9248+
// FIXME: Can we do this for indexed, compressing, or truncating stores?
9249+
if (ISD::isBuildVectorAllOnes(Mask.getNode()) &&
9250+
MST->isUnindexed() && !MST->isCompressingStore() &&
9251+
!MST->isTruncatingStore())
9252+
return DAG.getStore(MST->getChain(), SDLoc(N), MST->getValue(),
9253+
MST->getBasePtr(), MST->getMemOperand());
9254+
92479255
// Try transforming N to an indexed store.
92489256
if (CombineToPreIndexedLoadStore(N) || CombineToPostIndexedLoadStore(N))
92499257
return SDValue(N, 0);

0 commit comments

Comments
 (0)