Skip to content

[RISCV] Use isCompatible when we need runtime VSETVLIInfo equality. NFC #94340

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jun 15, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions llvm/lib/Target/RISCV/RISCVInsertVSETVLI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,13 @@ struct DemandedFields {
VLZeroness = true;
}

static DemandedFields all() {
DemandedFields DF;
DF.demandVTYPE();
DF.demandVL();
return DF;
}

// Make this the result of demanding both the fields in this and B.
void doUnion(const DemandedFields &B) {
VLAny |= B.VLAny;
Expand Down Expand Up @@ -713,14 +720,12 @@ class VSETVLIInfo {
const LiveIntervals *LIS) const {
assert(isValid() && Require.isValid() &&
"Can't compare invalid VSETVLIInfos");
assert(!Require.SEWLMULRatioOnly &&
"Expected a valid VTYPE for instruction!");
// Nothing is compatible with Unknown.
if (isUnknown() || Require.isUnknown())
return false;

// If only our VLMAX ratio is valid, then this isn't compatible.
if (SEWLMULRatioOnly)
if (SEWLMULRatioOnly || Require.SEWLMULRatioOnly)
return false;

if (Used.VLAny && !(hasSameAVL(Require) && hasSameVLMAX(Require)))
Expand Down Expand Up @@ -1412,7 +1417,7 @@ void RISCVInsertVSETVLI::emitVSETVLIs(MachineBasicBlock &MBB) {

uint64_t TSFlags = MI.getDesc().TSFlags;
if (RISCVII::hasSEWOp(TSFlags)) {
if (PrevInfo != CurInfo) {
if (!PrevInfo.isCompatible(DemandedFields::all(), CurInfo, LIS)) {
// If this is the first implicit state change, and the state change
// requested can be proven to produce the same register contents, we
// can skip emitting the actual state change and continue as if we
Expand Down
Loading