[llvm-branch-commits] [llvm] c0ef36f - RISCV: Pass instruction and operand index to vectorPseudoHasAllNBitUsers (#219993)
via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Tue Sep 1 14:54:24 PDT 2026
Author: Matt Arsenault
Date: 2026-08-31T21:36:41+02:00
New Revision: c0ef36f16631b263bd871e50ea2d0cbcd330233a
URL: https://github.com/llvm/llvm-project/commit/c0ef36f16631b263bd871e50ea2d0cbcd330233a
DIFF: https://github.com/llvm/llvm-project/commit/c0ef36f16631b263bd871e50ea2d0cbcd330233a.diff
LOG: RISCV: Pass instruction and operand index to vectorPseudoHasAllNBitUsers (#219993)
Take the user instruction and operand index directly instead of a
MachineOperand, so the helper no longer relies on getParent.
Co-authored-by: Claude (Claude-Opus-4.8)
Added:
Modified:
llvm/lib/Target/RISCV/RISCVOptWInstrs.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Target/RISCV/RISCVOptWInstrs.cpp b/llvm/lib/Target/RISCV/RISCVOptWInstrs.cpp
index 08d72f28b9e0b..45e119a1c03d5 100644
--- a/llvm/lib/Target/RISCV/RISCVOptWInstrs.cpp
+++ b/llvm/lib/Target/RISCV/RISCVOptWInstrs.cpp
@@ -98,9 +98,8 @@ FunctionPass *llvm::createRISCVOptWInstrsLegacyPass() {
return new RISCVOptWInstrsLegacy();
}
-static bool vectorPseudoHasAllNBitUsers(const MachineOperand &UserOp,
+static bool vectorPseudoHasAllNBitUsers(const MachineInstr &MI, unsigned OpIdx,
unsigned Bits) {
- const MachineInstr &MI = *UserOp.getParent();
unsigned MCOpcode = RISCV::getRVVMCOpcode(MI.getOpcode());
if (!MCOpcode)
@@ -113,7 +112,7 @@ static bool vectorPseudoHasAllNBitUsers(const MachineOperand &UserOp,
assert(RISCVII::hasVLOp(TSFlags));
const unsigned Log2SEW = MI.getOperand(RISCVII::getSEWOpNum(MCID)).getImm();
- if (UserOp.getOperandNo() == RISCVII::getVLOpNum(MCID))
+ if (OpIdx == RISCVII::getVLOpNum(MCID))
return false;
auto NumDemandedBits =
@@ -155,7 +154,7 @@ static bool hasAllNBitUsers(const MachineInstr &OrigMI,
switch (UserMI->getOpcode()) {
default:
- if (vectorPseudoHasAllNBitUsers(UserOp, Bits))
+ if (vectorPseudoHasAllNBitUsers(*UserMI, OpIdx, Bits))
break;
return false;
More information about the llvm-branch-commits
mailing list