[llvm] [MCSched] Allow tuning LoadLatency/MispredictPenalty (PR #203139)
via llvm-commits
llvm-commits at lists.llvm.org
Wed Jun 10 18:07:07 PDT 2026
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {clang-format}-->
:warning: C/C++ code formatter, clang-format found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
git-clang-format --diff origin/main HEAD --extensions h,cpp -- llvm/include/llvm/MC/MCSchedule.h llvm/lib/CodeGen/EarlyIfConversion.cpp llvm/lib/CodeGen/SelectOptimize.cpp llvm/lib/CodeGen/TargetInstrInfo.cpp llvm/lib/MC/MCSchedule.cpp llvm/lib/Target/AArch64/AArch64ConditionalCompares.cpp llvm/lib/Target/ARM/ARMSubtarget.cpp llvm/lib/Target/RISCV/RISCVSubtarget.cpp llvm/lib/Target/X86/X86CmovConversion.cpp --diff_from_common_commit
``````````
:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/llvm/lib/CodeGen/SelectOptimize.cpp b/llvm/lib/CodeGen/SelectOptimize.cpp
index 2637e6478..01d69faaa 100644
--- a/llvm/lib/CodeGen/SelectOptimize.cpp
+++ b/llvm/lib/CodeGen/SelectOptimize.cpp
@@ -1414,7 +1414,8 @@ SelectOptimizeImpl::computeInstCost(const Instruction *I) {
ScaledNumber<uint64_t>
SelectOptimizeImpl::getMispredictionCost(const SelectLike SI,
const Scaled64 CondCost) {
- uint64_t MispredictPenalty = TSchedModel.getMCSchedModel()->getMispredictPenalty();
+ uint64_t MispredictPenalty =
+ TSchedModel.getMCSchedModel()->getMispredictPenalty();
// Account for the default misprediction rate when using a branch
// (conservatively set to 25% by default).
diff --git a/llvm/lib/MC/MCSchedule.cpp b/llvm/lib/MC/MCSchedule.cpp
index 0aa7f8e6f..8808343b2 100644
--- a/llvm/lib/MC/MCSchedule.cpp
+++ b/llvm/lib/MC/MCSchedule.cpp
@@ -34,8 +34,7 @@ static cl::opt<int> SchedMispredictPenalty(
"model. A non-negative value overrides the target default."));
static cl::opt<int> SchedLoadLatency(
- "sched-load-latency", cl::Hidden, cl::init(-1),
- cl::cat(MCScheduleOptions),
+ "sched-load-latency", cl::Hidden, cl::init(-1), cl::cat(MCScheduleOptions),
cl::desc("Override the load latency (in cycles) in the scheduler model. "
"A non-negative value overrides the target default."));
diff --git a/llvm/lib/Target/X86/X86CmovConversion.cpp b/llvm/lib/Target/X86/X86CmovConversion.cpp
index 25d23b547..a14d8d897 100644
--- a/llvm/lib/Target/X86/X86CmovConversion.cpp
+++ b/llvm/lib/Target/X86/X86CmovConversion.cpp
@@ -546,7 +546,8 @@ bool X86CmovConversionImpl::checkForProfitableCmovCandidates(
// To be conservative, the gain of such CMOV transformation should cover at
// at least 25% of branch-misprediction-penalty.
//===--------------------------------------------------------------------===//
- unsigned MispredictPenalty = TSchedModel.getMCSchedModel()->getMispredictPenalty();
+ unsigned MispredictPenalty =
+ TSchedModel.getMCSchedModel()->getMispredictPenalty();
CmovGroups TempGroups;
std::swap(TempGroups, CmovInstGroups);
for (auto &Group : TempGroups) {
``````````
</details>
https://github.com/llvm/llvm-project/pull/203139
More information about the llvm-commits
mailing list