[llvm] cc45687 - [RISCV] Simpify operand index calculation in createMIROperandComment [nfc]

Philip Reames via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 13 15:07:00 PDT 2022


Author: Philip Reames
Date: 2022-09-13T15:06:40-07:00
New Revision: cc45687e1cb30e4f5464bfbbd43aa654128ff761

URL: https://github.com/llvm/llvm-project/commit/cc45687e1cb30e4f5464bfbbd43aa654128ff761
DIFF: https://github.com/llvm/llvm-project/commit/cc45687e1cb30e4f5464bfbbd43aa654128ff761.diff

LOG: [RISCV] Simpify operand index calculation in createMIROperandComment [nfc]

Added: 
    

Modified: 
    llvm/lib/Target/RISCV/RISCVInstrInfo.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/RISCV/RISCVInstrInfo.cpp b/llvm/lib/Target/RISCV/RISCVInstrInfo.cpp
index 1c47ac18b1b2..cf9925135bfe 100644
--- a/llvm/lib/Target/RISCV/RISCVInstrInfo.cpp
+++ b/llvm/lib/Target/RISCV/RISCVInstrInfo.cpp
@@ -1504,18 +1504,11 @@ std::string RISCVInstrInfo::createMIROperandComment(
       OpIdx == 2) {
     unsigned Imm = MI.getOperand(OpIdx).getImm();
     RISCVVType::printVType(Imm, OS);
-  } else if (RISCVII::hasSEWOp(TSFlags)) {
-    unsigned NumOperands = MI.getNumExplicitOperands();
-    bool HasPolicy = RISCVII::hasVecPolicyOp(TSFlags);
-
-    // The SEW operand is before any policy operand.
-    if (OpIdx != NumOperands - HasPolicy - 1)
-      return std::string();
-
+  } else if (RISCVII::hasSEWOp(TSFlags) &&
+             OpIdx == RISCVII::getSEWOpNum(MI.getDesc())) {
     unsigned Log2SEW = MI.getOperand(OpIdx).getImm();
     unsigned SEW = Log2SEW ? 1 << Log2SEW : 8;
     assert(RISCVVType::isValidSEW(SEW) && "Unexpected SEW");
-
     OS << "e" << SEW;
   }
 


        


More information about the llvm-commits mailing list