Skip to content

Commit a860e89

Browse files
committed
[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.
1 parent 42a0fb2 commit a860e89

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

llvm/lib/Target/RISCV/RISCVInsertVSETVLI.cpp

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -882,7 +882,7 @@ class RISCVInsertVSETVLI : public MachineFunctionPass {
882882
StringRef getPassName() const override { return RISCV_INSERT_VSETVLI_NAME; }
883883

884884
private:
885-
bool needVSETVLI(const MachineInstr &MI, const VSETVLIInfo &Require,
885+
bool needVSETVLI(const DemandedFields &Used, const VSETVLIInfo &Require,
886886
const VSETVLIInfo &CurInfo) const;
887887
bool needVSETVLIPHI(const VSETVLIInfo &Require,
888888
const MachineBasicBlock &MBB) const;
@@ -1175,17 +1175,13 @@ void RISCVInsertVSETVLI::insertVSETVLI(MachineBasicBlock &MBB,
11751175
}
11761176

11771177
/// Return true if a VSETVLI is required to transition from CurInfo to Require
1178-
/// before MI.
1179-
bool RISCVInsertVSETVLI::needVSETVLI(const MachineInstr &MI,
1178+
/// given a set of DemandedFields \p Used.
1179+
bool RISCVInsertVSETVLI::needVSETVLI(const DemandedFields &Used,
11801180
const VSETVLIInfo &Require,
11811181
const VSETVLIInfo &CurInfo) const {
1182-
assert(Require == computeInfoForInstr(MI, MI.getDesc().TSFlags, *ST, LIS));
1183-
11841182
if (!CurInfo.isValid() || CurInfo.isUnknown() || CurInfo.hasSEWLMULRatioOnly())
11851183
return true;
11861184

1187-
DemandedFields Used = getDemanded(MI, ST);
1188-
11891185
if (CurInfo.isCompatible(Used, Require, LIS))
11901186
return false;
11911187

@@ -1232,16 +1228,17 @@ void RISCVInsertVSETVLI::transferBefore(VSETVLIInfo &Info,
12321228
if (!RISCVII::hasSEWOp(TSFlags))
12331229
return;
12341230

1231+
DemandedFields Demanded = getDemanded(MI, ST);
1232+
12351233
const VSETVLIInfo NewInfo = computeInfoForInstr(MI, TSFlags, *ST, LIS);
12361234
assert(NewInfo.isValid() && !NewInfo.isUnknown());
1237-
if (Info.isValid() && !needVSETVLI(MI, NewInfo, Info))
1235+
if (Info.isValid() && !needVSETVLI(Demanded, NewInfo, Info))
12381236
return;
12391237

12401238
const VSETVLIInfo PrevInfo = Info;
12411239
if (!Info.isValid() || Info.isUnknown())
12421240
Info = NewInfo;
12431241

1244-
DemandedFields Demanded = getDemanded(MI, ST);
12451242
const VSETVLIInfo IncomingInfo = adjustIncoming(PrevInfo, NewInfo, Demanded);
12461243

12471244
// If MI only demands that VL has the same zeroness, we only need to set the

0 commit comments

Comments
 (0)