Skip to content

Commit a7612e2

Browse files
authored
[CodeGen] Improve compilation time with VLIWMachineScheduler (#66942)
A straight forward improvement which can already achieve 2x speed up in some cases like the one here: #65946.
1 parent d56537a commit a7612e2

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

llvm/include/llvm/CodeGen/VLIWMachineScheduler.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,8 +165,9 @@ class ConvergingVLIWScheduler : public MachineSchedStrategy {
165165
// a slightly different heuristic for small and large functions. For small
166166
// functions, it's important to use the height/depth of the instruction.
167167
// For large functions, prioritizing by height or depth increases spills.
168-
CriticalPathLength = DAG->getBBSize() / SchedModel->getIssueWidth();
169-
if (DAG->getBBSize() < 50)
168+
const auto BBSize = DAG->getBBSize();
169+
CriticalPathLength = BBSize / SchedModel->getIssueWidth();
170+
if (BBSize < 50)
170171
// We divide by two as a cheap and simple heuristic to reduce the
171172
// critcal path length, which increases the priority of using the graph
172173
// height/depth in the scheduler's cost computation.

0 commit comments

Comments
 (0)