Skip to content

Commit 27d996e

Browse files
committed
[RISCV] Remove Change field from BlockData in RISCVInsertVSETVLI. NFC
In practice, this field is only used a return value from computeVLVTYPEChanges. Add a reference parameter to computeVLVTYPEChanges to return its info. Reviewed By: reames Differential Revision: https://reviews.llvm.org/D158902
1 parent 0edc32f commit 27d996e

File tree

1 file changed

+18
-18
lines changed

1 file changed

+18
-18
lines changed

llvm/lib/Target/RISCV/RISCVInsertVSETVLI.cpp

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -691,10 +691,6 @@ inline raw_ostream &operator<<(raw_ostream &OS, const VSETVLIInfo &V) {
691691
#endif
692692

693693
struct BlockData {
694-
// The VSETVLIInfo that represents the net changes to the VL/VTYPE registers
695-
// made by this block. Calculated in Phase 1.
696-
VSETVLIInfo Change;
697-
698694
// The VSETVLIInfo that represents the VL/VTYPE settings on exit from this
699695
// block. Calculated in Phase 2.
700696
VSETVLIInfo Exit;
@@ -742,9 +738,10 @@ class RISCVInsertVSETVLI : public MachineFunctionPass {
742738
MachineBasicBlock::iterator InsertPt, DebugLoc DL,
743739
const VSETVLIInfo &Info, const VSETVLIInfo &PrevInfo);
744740

745-
void transferBefore(VSETVLIInfo &Info, const MachineInstr &MI);
746-
void transferAfter(VSETVLIInfo &Info, const MachineInstr &MI);
747-
bool computeVLVTYPEChanges(const MachineBasicBlock &MBB);
741+
void transferBefore(VSETVLIInfo &Info, const MachineInstr &MI) const;
742+
void transferAfter(VSETVLIInfo &Info, const MachineInstr &MI) const;
743+
bool computeVLVTYPEChanges(const MachineBasicBlock &MBB,
744+
VSETVLIInfo &Info) const;
748745
void computeIncomingVLVTYPE(const MachineBasicBlock &MBB);
749746
void emitVSETVLIs(MachineBasicBlock &MBB);
750747
void doLocalPostpass(MachineBasicBlock &MBB);
@@ -1006,7 +1003,8 @@ bool RISCVInsertVSETVLI::needVSETVLI(const MachineInstr &MI,
10061003
// Given an incoming state reaching MI, modifies that state so that it is minimally
10071004
// compatible with MI. The resulting state is guaranteed to be semantically legal
10081005
// for MI, but may not be the state requested by MI.
1009-
void RISCVInsertVSETVLI::transferBefore(VSETVLIInfo &Info, const MachineInstr &MI) {
1006+
void RISCVInsertVSETVLI::transferBefore(VSETVLIInfo &Info,
1007+
const MachineInstr &MI) const {
10101008
uint64_t TSFlags = MI.getDesc().TSFlags;
10111009
if (!RISCVII::hasSEWOp(TSFlags))
10121010
return;
@@ -1063,7 +1061,8 @@ void RISCVInsertVSETVLI::transferBefore(VSETVLIInfo &Info, const MachineInstr &M
10631061
// Given a state with which we evaluated MI (see transferBefore above for why
10641062
// this might be different that the state MI requested), modify the state to
10651063
// reflect the changes MI might make.
1066-
void RISCVInsertVSETVLI::transferAfter(VSETVLIInfo &Info, const MachineInstr &MI) {
1064+
void RISCVInsertVSETVLI::transferAfter(VSETVLIInfo &Info,
1065+
const MachineInstr &MI) const {
10671066
if (isVectorConfigInstr(MI)) {
10681067
Info = getInfoForVSETVLI(MI);
10691068
return;
@@ -1082,18 +1081,18 @@ void RISCVInsertVSETVLI::transferAfter(VSETVLIInfo &Info, const MachineInstr &MI
10821081
Info = VSETVLIInfo::getUnknown();
10831082
}
10841083

1085-
bool RISCVInsertVSETVLI::computeVLVTYPEChanges(const MachineBasicBlock &MBB) {
1084+
bool RISCVInsertVSETVLI::computeVLVTYPEChanges(const MachineBasicBlock &MBB,
1085+
VSETVLIInfo &Info) const {
10861086
bool HadVectorOp = false;
10871087

1088-
BlockData &BBInfo = BlockInfo[MBB.getNumber()];
1089-
BBInfo.Change = BBInfo.Pred;
1088+
Info = BlockInfo[MBB.getNumber()].Pred;
10901089
for (const MachineInstr &MI : MBB) {
1091-
transferBefore(BBInfo.Change, MI);
1090+
transferBefore(Info, MI);
10921091

10931092
if (isVectorConfigInstr(MI) || RISCVII::hasSEWOp(MI.getDesc().TSFlags))
10941093
HadVectorOp = true;
10951094

1096-
transferAfter(BBInfo.Change, MI);
1095+
transferAfter(Info, MI);
10971096
}
10981097

10991098
return HadVectorOp;
@@ -1132,8 +1131,8 @@ void RISCVInsertVSETVLI::computeIncomingVLVTYPE(const MachineBasicBlock &MBB) {
11321131
// compatibility checks performed a blocks output state can change based on
11331132
// the input state. To cache, we'd have to add logic for finding
11341133
// never-compatible state changes.
1135-
computeVLVTYPEChanges(MBB);
1136-
VSETVLIInfo TmpStatus = BBInfo.Change;
1134+
VSETVLIInfo TmpStatus;
1135+
computeVLVTYPEChanges(MBB, TmpStatus);
11371136

11381137
// If the new exit value matches the old exit value, we don't need to revisit
11391138
// any blocks.
@@ -1528,10 +1527,11 @@ bool RISCVInsertVSETVLI::runOnMachineFunction(MachineFunction &MF) {
15281527

15291528
// Phase 1 - determine how VL/VTYPE are affected by the each block.
15301529
for (const MachineBasicBlock &MBB : MF) {
1531-
HaveVectorOp |= computeVLVTYPEChanges(MBB);
1530+
VSETVLIInfo TmpStatus;
1531+
HaveVectorOp |= computeVLVTYPEChanges(MBB, TmpStatus);
15321532
// Initial exit state is whatever change we found in the block.
15331533
BlockData &BBInfo = BlockInfo[MBB.getNumber()];
1534-
BBInfo.Exit = BBInfo.Change;
1534+
BBInfo.Exit = TmpStatus;
15351535
LLVM_DEBUG(dbgs() << "Initial exit state of " << printMBBReference(MBB)
15361536
<< " is " << BBInfo.Exit << "\n");
15371537

0 commit comments

Comments
 (0)