[llvm] [RISCV] Model dest EEW and fix peepholes not checking EEW (PR #105945)

Luke Lau via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 4 19:48:04 PDT 2024


================
@@ -96,10 +97,17 @@ static bool isVLKnownLE(const MachineOperand &LHS, const MachineOperand &RHS) {
   return LHS.getImm() <= RHS.getImm();
 }
 
-static unsigned getSEWLMULRatio(const MachineInstr &MI) {
-  RISCVII::VLMUL LMUL = RISCVII::getLMul(MI.getDesc().TSFlags);
-  unsigned Log2SEW = MI.getOperand(RISCVII::getSEWOpNum(MI.getDesc())).getImm();
-  return RISCVVType::getSEWLMULRatio(1 << Log2SEW, LMUL);
+/// Given \p User that has an input operand with EEW=SEW, which uses the dest
+/// operand of \p Src with an unknown EEW, return true if their EEWs match.
+bool RISCVVectorPeephole::hasSameEEW(const MachineInstr &User,
+                                     const MachineInstr &Src) const {
+  unsigned UserSEW =
----------------
lukel97 wrote:

Good point actually, this led me to realise that getDestEEW was incorrectly returning the non-log2 EEW for mask types. Fixed now

https://github.com/llvm/llvm-project/pull/105945


More information about the llvm-commits mailing list