[llvm] [RISCV] Don't use MachineInstr::isIdenticalTo in hasSameAVL (PR #90431)

Luke Lau via llvm-commits llvm-commits at lists.llvm.org
Sun Apr 28 22:58:35 PDT 2024


https://github.com/lukel97 created https://github.com/llvm/llvm-project/pull/90431

MachineInstr::isIdenticalTo compares that the operands and flags are the same IIUC, but I think we actually want to check that it's the same MachineInstr * with respect to position in the block etc.


>From 9cc577bbb9bff94f4eef67460548223ca2188d9e Mon Sep 17 00:00:00 2001
From: Luke Lau <luke at igalia.com>
Date: Mon, 29 Apr 2024 13:56:03 +0800
Subject: [PATCH] [RISCV] Don't use MachineInstr::isIdenticalTo in hasSameAVL

MachineInstr::isIdenticalTo compares that the operands and flags are the same IIUC, but I think we actually want to check that it's the same MachineInstr * with respect to position in the block etc.
---
 llvm/lib/Target/RISCV/RISCVInsertVSETVLI.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/llvm/lib/Target/RISCV/RISCVInsertVSETVLI.cpp b/llvm/lib/Target/RISCV/RISCVInsertVSETVLI.cpp
index b5fd508fa77de2..b27e1dd258ebd0 100644
--- a/llvm/lib/Target/RISCV/RISCVInsertVSETVLI.cpp
+++ b/llvm/lib/Target/RISCV/RISCVInsertVSETVLI.cpp
@@ -568,8 +568,8 @@ class VSETVLIInfo {
 
   bool hasSameAVL(const VSETVLIInfo &Other) const {
     if (hasAVLReg() && Other.hasAVLReg())
-      return getAVLDefMI().isIdenticalTo(Other.getAVLDefMI()) &&
-             getAVLReg() == Other.getAVLReg();
+      return AVLRegDef.DefMI == Other.AVLRegDef.DefMI &&
+             AVLRegDef.DefReg == Other.AVLRegDef.DefReg;
 
     if (hasAVLImm() && Other.hasAVLImm())
       return getAVLImm() == Other.getAVLImm();



More information about the llvm-commits mailing list