[llvm] [RISCV] Allow folding vmerge into masked ops when mask is the same (PR #97989)
Luke Lau via llvm-commits
llvm-commits at lists.llvm.org
Sun Jul 7 23:23:28 PDT 2024
================
@@ -3755,12 +3766,16 @@ bool RISCVDAGToDAGISel::performCombineVMergeAndVOps(SDNode *N) {
return false;
}
- // If True is masked then the vmerge must have an all 1s mask, since we're
- // going to keep the mask from True.
+ // If True is masked then the vmerge must have either the same mask or an all
+ // 1s mask, since we're going to keep the mask from True.
if (IsMasked && Mask) {
// FIXME: Support mask agnostic True instruction which would have an
// undef merge operand.
- if (!usesAllOnesMask(Mask, Glue))
+ SDValue TrueMask =
+ getMaskSetter(True->getOperand(Info->MaskOpIdx),
+ True->getOperand(True->getNumOperands() - 1));
----------------
lukel97 wrote:
This is a bit gnarly but I still hope to eventually move all this into RISCVFoldMasks.cpp. Sorry for dropping the ball on that
https://github.com/llvm/llvm-project/pull/97989
More information about the llvm-commits
mailing list