[PATCH] D139682: [DAG] Stop replace masked compressstore with normal masked store

Xiang Zhang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 8 16:53:18 PST 2022


xiangzhangllvm created this revision.
xiangzhangllvm added reviewers: RKSimon, pengfei, LuoYuanke.
Herald added subscribers: ecnelises, hiraditya.
Herald added a project: All.
xiangzhangllvm requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

The masked compressstore can not be replaced with normal masked store.
Because masked compressstore required **adjacently **store the masked elements
which normal masked store can not make sure.


https://reviews.llvm.org/D139682

Files:
  llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
  llvm/test/CodeGen/X86/masked_compressstore_isel.ll


Index: llvm/test/CodeGen/X86/masked_compressstore_isel.ll
===================================================================
--- llvm/test/CodeGen/X86/masked_compressstore_isel.ll
+++ llvm/test/CodeGen/X86/masked_compressstore_isel.ll
@@ -12,7 +12,8 @@
 ; 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)
Index: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
===================================================================
--- llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
+++ llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
@@ -11031,9 +11031,9 @@
 
   // 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.
   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(),


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D139682.481474.patch
Type: text/x-patch
Size: 1639 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20221209/e474f93c/attachment.bin>


More information about the llvm-commits mailing list