[PATCH] D132700: [DSE] Add value type checks for masked store candidates in Dead Store Elimination

Florian Hahn via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 30 13:03:53 PDT 2022


fhahn added inline comments.


================
Comment at: llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp:245
     return OW_Unknown;
-  if (KillingII->getIntrinsicID() != Intrinsic::masked_store ||
-      DeadII->getIntrinsicID() != Intrinsic::masked_store)
+  // Only like type intrinsics...
+  if (KillingII->getIntrinsicID() != DeadII->getIntrinsicID())
----------------
I am not sure I understand the meaning of the comment. Could you re-phrase?


================
Comment at: llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp:251
+    if (KillingII->getArgOperand(0)->getType() !=
+        DeadII->getArgOperand(0)->getType())
+      return OW_Unknown;
----------------
StephenFan wrote:
> Is it possible to relax the comparison from type to type size?
Yeah it would be good to check the stored sizes instead of requiring the types to match. I think we should remove one store if both masked stores are flipped.


================
Comment at: llvm/test/Transforms/DeadStoreElimination/masked-dead-store-no-merge.ll:11
+;
+  tail call void @llvm.masked.store.v4i32.p0(<4 x i32> %v2, ptr %a, i32 1, <4 x i1> <i1 true, i1 true, i1 true, i1 true>)
+  tail call void @llvm.masked.store.v4i8.p0(<4 x i8> %v1, ptr %a, i32 1, <4 x i1> <i1 true, i1 true, i1 true, i1 true>)
----------------
Could you instead extend the existing masked store test? `llvm/test/Transforms/DeadStoreElimination/masked-dead-store.ll`

Also, it would be good to pre-commit the test separately and only include the changed lines caused by the patch in this diff.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D132700/new/

https://reviews.llvm.org/D132700



More information about the llvm-commits mailing list