Skip to content

TargetInstrInfo, TargetSchedule: fix non-NFC parts of 9468de4 #74338

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 1 commit into from
Dec 5, 2023
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion llvm/lib/CodeGen/TargetInstrInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1462,7 +1462,7 @@ bool TargetInstrInfo::hasLowDefLatency(const TargetSchedModel &SchedModel,
unsigned DefClass = DefMI.getDesc().getSchedClass();
std::optional<unsigned> DefCycle =
ItinData->getOperandCycle(DefClass, DefIdx);
return DefCycle <= 1U;
return DefCycle && DefCycle <= 1U;
}

bool TargetInstrInfo::isFunctionSafeToSplit(const MachineFunction &MF) const {
Expand Down
2 changes: 1 addition & 1 deletion llvm/lib/CodeGen/TargetSchedule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ unsigned TargetSchedModel::computeOperandLatency(
const unsigned DefaultDefLatency = TII->defaultDefLatency(SchedModel, *DefMI);

if (!hasInstrSchedModel() && !hasInstrItineraries())
return InstrLatency;
return DefaultDefLatency;

if (hasInstrItineraries()) {
std::optional<unsigned> OperLatency;
Expand Down
2 changes: 1 addition & 1 deletion llvm/lib/Target/ARM/ARMBaseInstrInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4836,7 +4836,7 @@ bool ARMBaseInstrInfo::hasLowDefLatency(const TargetSchedModel &SchedModel,
unsigned DefClass = DefMI.getDesc().getSchedClass();
std::optional<unsigned> DefCycle =
ItinData->getOperandCycle(DefClass, DefIdx);
return DefCycle <= 2U;
return DefCycle && DefCycle <= 2U;
}
return false;
}
Expand Down