From 9c88ccf9a9bf95f323597aed697fb472058c7daa Mon Sep 17 00:00:00 2001 From: Xiang1 Zhang Date: Thu, 8 Dec 2022 17:24:20 +0800 Subject: [PATCH] [DAG] Stop combine for masked compressstore Reviewed By: WangPengfei Differential Revision: https://reviews.llvm.org/D139682 --- llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp | 5 +++-- llvm/test/CodeGen/X86/masked_compressstore_isel.ll | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp index 7c888fa..6d76680 100644 --- a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp @@ -11030,9 +11030,10 @@ SDValue DAGCombiner::visitMSTORE(SDNode *N) { // If this is a TRUNC followed by a masked store, fold this into a masked // truncating store. We can do this even if this is already a masked - // truncstore. + // truncstore or a compress store. + // TODO: Try combine to masked compress store if possiable. if ((Value.getOpcode() == ISD::TRUNCATE) && Value->hasOneUse() && - MST->isUnindexed() && + MST->isUnindexed() && !MST->isCompressingStore() && TLI.canCombineTruncStore(Value.getOperand(0).getValueType(), MST->getMemoryVT(), LegalOperations)) { auto Mask = TLI.promoteTargetBoolean(DAG, MST->getMask(), diff --git a/llvm/test/CodeGen/X86/masked_compressstore_isel.ll b/llvm/test/CodeGen/X86/masked_compressstore_isel.ll index 5c03873..db1f9ae 100644 --- a/llvm/test/CodeGen/X86/masked_compressstore_isel.ll +++ b/llvm/test/CodeGen/X86/masked_compressstore_isel.ll @@ -12,7 +12,8 @@ entry: ; CHECK-NEXT: %0:vr256x = COPY $ymm0 ; CHECK-NEXT: %2:vr128x = VPSLLWZ128ri %1, 15 ; CHECK-NEXT: %3:vk16wm = VPMOVW2MZ128rr killed %2 -; CHECK-NEXT: VPMOVDWZ256mrk $noreg, 1, $noreg, 0, $noreg, killed %3, %0 :: (store unknown-size into `i16* null`, align 16) +; CHECK-NEXT: %4:vr128x = VPMOVDWZ256rr %0 +; CHECK-NEXT: VPCOMPRESSWZ128mrk $noreg, 1, $noreg, 0, $noreg, killed %3, killed %4 :: (store unknown-size into `i16* null`, align 16) ; CHECK-NEXT: RET 0 ; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: write) -- 2.7.4