[llvm] a860e89 - [RISCV] Don't recompute getDemanded in RISCVInsertVSETVLI::needVSETVLI. NFC
Luke Lau via llvm-commits
llvm-commits at lists.llvm.org
Wed May 29 04:20:24 PDT 2024
Author: Luke Lau
Date: 2024-05-29T12:19:23+01:00
New Revision: a860e89028a004bc5b46ce0952b75d4f85a5927d
URL: https://github.com/llvm/llvm-project/commit/a860e89028a004bc5b46ce0952b75d4f85a5927d
DIFF: https://github.com/llvm/llvm-project/commit/a860e89028a004bc5b46ce0952b75d4f85a5927d.diff
LOG: [RISCV] Don't recompute getDemanded in RISCVInsertVSETVLI::needVSETVLI. NFC
This also makes the function a bit easier to reason about since we can
remove the assert. Eventually we might be able to replace needVSETVLI
with VSETVLIInfo::isCompatible.
Added:
Modified:
llvm/lib/Target/RISCV/RISCVInsertVSETVLI.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Target/RISCV/RISCVInsertVSETVLI.cpp b/llvm/lib/Target/RISCV/RISCVInsertVSETVLI.cpp
index c0b2a695b8ea4..2c0a807e44685 100644
--- a/llvm/lib/Target/RISCV/RISCVInsertVSETVLI.cpp
+++ b/llvm/lib/Target/RISCV/RISCVInsertVSETVLI.cpp
@@ -882,7 +882,7 @@ class RISCVInsertVSETVLI : public MachineFunctionPass {
StringRef getPassName() const override { return RISCV_INSERT_VSETVLI_NAME; }
private:
- bool needVSETVLI(const MachineInstr &MI, const VSETVLIInfo &Require,
+ bool needVSETVLI(const DemandedFields &Used, const VSETVLIInfo &Require,
const VSETVLIInfo &CurInfo) const;
bool needVSETVLIPHI(const VSETVLIInfo &Require,
const MachineBasicBlock &MBB) const;
@@ -1175,17 +1175,13 @@ void RISCVInsertVSETVLI::insertVSETVLI(MachineBasicBlock &MBB,
}
/// Return true if a VSETVLI is required to transition from CurInfo to Require
-/// before MI.
-bool RISCVInsertVSETVLI::needVSETVLI(const MachineInstr &MI,
+/// given a set of DemandedFields \p Used.
+bool RISCVInsertVSETVLI::needVSETVLI(const DemandedFields &Used,
const VSETVLIInfo &Require,
const VSETVLIInfo &CurInfo) const {
- assert(Require == computeInfoForInstr(MI, MI.getDesc().TSFlags, *ST, LIS));
-
if (!CurInfo.isValid() || CurInfo.isUnknown() || CurInfo.hasSEWLMULRatioOnly())
return true;
- DemandedFields Used = getDemanded(MI, ST);
-
if (CurInfo.isCompatible(Used, Require, LIS))
return false;
@@ -1232,16 +1228,17 @@ void RISCVInsertVSETVLI::transferBefore(VSETVLIInfo &Info,
if (!RISCVII::hasSEWOp(TSFlags))
return;
+ DemandedFields Demanded = getDemanded(MI, ST);
+
const VSETVLIInfo NewInfo = computeInfoForInstr(MI, TSFlags, *ST, LIS);
assert(NewInfo.isValid() && !NewInfo.isUnknown());
- if (Info.isValid() && !needVSETVLI(MI, NewInfo, Info))
+ if (Info.isValid() && !needVSETVLI(Demanded, NewInfo, Info))
return;
const VSETVLIInfo PrevInfo = Info;
if (!Info.isValid() || Info.isUnknown())
Info = NewInfo;
- DemandedFields Demanded = getDemanded(MI, ST);
const VSETVLIInfo IncomingInfo = adjustIncoming(PrevInfo, NewInfo, Demanded);
// If MI only demands that VL has the same zeroness, we only need to set the
More information about the llvm-commits
mailing list