[llvm] [DSE] Add predicated vector length store support for masked store elimination (PR #134175)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Wed Apr 2 23:59:11 PDT 2025
================
@@ -269,6 +269,41 @@ static OverwriteResult isMaskedStoreOverwrite(const Instruction *KillingI,
return OW_Unknown;
return OW_Complete;
}
+ if (KillingII->getIntrinsicID() == Intrinsic::vp_store) {
+ // Operands {0 , 1 , 2 , 3 }
+ // {StoredVal, VecPtr, Mask, VL}
+ // Types.
+ VectorType *KillingTy =
+ cast<VectorType>(KillingII->getArgOperand(0)->getType());
+ VectorType *DeadTy = cast<VectorType>(DeadII->getArgOperand(0)->getType());
+ if (KillingTy->getScalarSizeInBits() != DeadTy->getScalarSizeInBits())
+ return OW_Unknown;
+ // Element count.
+ if (KillingTy->getElementCount() != DeadTy->getElementCount())
+ return OW_Unknown;
+ // Pointers.
+ Value *KillingPtr = KillingII->getArgOperand(1)->stripPointerCasts();
+ Value *DeadPtr = DeadII->getArgOperand(1)->stripPointerCasts();
----------------
nikic wrote:
stripPointerCasts not needed.
https://github.com/llvm/llvm-project/pull/134175
More information about the llvm-commits
mailing list