[PATCH] D152961: [RISCV] Refactor vecPolicyOp skip logic in doPeepholeMaskedRVV. NFC
Luke Lau via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Jun 15 04:16:08 PDT 2023
luke updated this revision to Diff 531693.
luke added a comment.
Move assignment into if
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D152961/new/
https://reviews.llvm.org/D152961
Files:
llvm/lib/Target/RISCV/RISCVISelDAGToDAG.cpp
Index: llvm/lib/Target/RISCV/RISCVISelDAGToDAG.cpp
===================================================================
--- llvm/lib/Target/RISCV/RISCVISelDAGToDAG.cpp
+++ llvm/lib/Target/RISCV/RISCVISelDAGToDAG.cpp
@@ -3185,11 +3185,11 @@
bool UseTUPseudo = false;
if (RISCVII::hasVecPolicyOp(MaskedMCID.TSFlags)) {
+ TailPolicyOpIdx = getVecPolicyOpIdx(N, MaskedMCID);
// Some operations are their own TU.
if (I->UnmaskedTUPseudo == I->UnmaskedPseudo) {
UseTUPseudo = true;
} else {
- TailPolicyOpIdx = getVecPolicyOpIdx(N, MaskedMCID);
if (!(N->getConstantOperandVal(*TailPolicyOpIdx) &
RISCVII::TAIL_AGNOSTIC)) {
// Keep the true-masked instruction when there is no unmasked TU
@@ -3202,11 +3202,11 @@
}
unsigned Opc = UseTUPseudo ? I->UnmaskedTUPseudo : I->UnmaskedPseudo;
+ const MCInstrDesc &MCID = TII->get(Opc);
// If this instruction is tail agnostic, the unmasked instruction should not
// have a tied destination.
#ifndef NDEBUG
- const MCInstrDesc &MCID = TII->get(Opc);
bool HasTiedDest = RISCVII::isFirstDefTiedToFirstUse(MCID);
assert((UseTUPseudo == HasTiedDest) && "Unexpected pseudo to transform to");
#endif
@@ -3214,9 +3214,11 @@
SmallVector<SDValue, 8> Ops;
// Skip the merge operand at index 0 if !UseTUPseudo.
for (unsigned I = !UseTUPseudo, E = N->getNumOperands(); I != E; I++) {
- // Skip the mask, the policy, and the Glue.
+ // Skip the mask, the policy (if the unmasked doesn't have a policy op), and
+ // the Glue.
SDValue Op = N->getOperand(I);
- if (I == MaskOpIdx || I == TailPolicyOpIdx ||
+ if (I == MaskOpIdx ||
+ (I == TailPolicyOpIdx && !RISCVII::hasVecPolicyOp(MCID.TSFlags)) ||
Op.getValueType() == MVT::Glue)
continue;
Ops.push_back(Op);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D152961.531693.patch
Type: text/x-patch
Size: 1829 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230615/e8544991/attachment.bin>
More information about the llvm-commits
mailing list