[PATCH] D152961: [RISCV] Refactor vecPolicyOp skip logic in doPeepholeMaskedRVV. NFC

Philip Reames via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 16 16:40:07 PDT 2023


This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGb3137d5c688b: [RISCV] Refactor vecPolicyOp skip logic in doPeepholeMaskedRVV. NFC (authored by luke, committed by reames).

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
@@ -3181,11 +3181,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
@@ -3198,11 +3198,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
@@ -3210,9 +3210,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.532326.patch
Type: text/x-patch
Size: 1829 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230616/d343b045/attachment.bin>


More information about the llvm-commits mailing list