[llvm] [MISched] De-prioritize RegCritical when register pressure is critica… (PR #218493)

via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 25 02:02:43 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/CodeGen/MachineScheduler.h llvm/lib/CodeGen/MachineScheduler.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/MachineScheduler.cpp b/llvm/lib/CodeGen/MachineScheduler.cpp
index b363454ec..9f2eedb6b 100644
--- a/llvm/lib/CodeGen/MachineScheduler.cpp
+++ b/llvm/lib/CodeGen/MachineScheduler.cpp
@@ -255,7 +255,8 @@ static cl::opt<float> RegCriticalPressureThreshold(
     "misched-regcritical-pressure-threshold", cl::Hidden,
     cl::desc(
         "When region register pressure exceeds this ratio of the target limit, "
-        "de-prioritize the RegCritical heuristic. This allows latency and other "
+        "de-prioritize the RegCritical heuristic. This allows latency and "
+        "other "
         "heuristics more influence when spills are already inevitable. "
         "0.0 disables (default)."),
     cl::init(0.0f));
@@ -4002,10 +4003,9 @@ bool GenericScheduler::tryCandidate(SchedCandidate &Cand,
     return TryCand.Reason != NoCand;
 
   // Avoid increasing the max critical pressure in the scheduled region.
-  if (DAG->isTrackingPressure() && tryPressure(TryCand.RPDelta.CriticalMax,
-                                               Cand.RPDelta.CriticalMax,
-                                               TryCand, Cand, RegCritical, TRI,
-                                               DAG->MF)) {
+  if (DAG->isTrackingPressure() &&
+      tryPressure(TryCand.RPDelta.CriticalMax, Cand.RPDelta.CriticalMax,
+                  TryCand, Cand, RegCritical, TRI, DAG->MF)) {
     // When register pressure is already significantly over the limit,
     // spills are inevitable. If both candidates increase critical pressure,
     // the marginal benefit of choosing the one with a smaller increase is
@@ -4015,8 +4015,7 @@ bool GenericScheduler::tryCandidate(SchedCandidate &Cand,
     // When one candidate decreases pressure (UnitInc < 0) and the other
     // increases, always prefer the decreasing candidate.
     if (TryCand.RPDelta.CriticalMax.getUnitInc() < 0 ||
-        !isRegionPressureCriticallyHigh(
-            TryCand.RPDelta.CriticalMax.getPSet()))
+        !isRegionPressureCriticallyHigh(TryCand.RPDelta.CriticalMax.getPSet()))
       return TryCand.Reason != NoCand;
     // Fall through to latency and other heuristics.
   }

``````````

</details>


https://github.com/llvm/llvm-project/pull/218493


More information about the llvm-commits mailing list