[llvm] a7612e2 - [CodeGen] Improve compilation time with VLIWMachineScheduler (#66942)

via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 21 09:18:13 PDT 2023


Author: Dávid Ferenc Szabó
Date: 2023-09-21T11:18:09-05:00
New Revision: a7612e2e7ebfa6e8a9504c7a56b406984620534f

URL: https://github.com/llvm/llvm-project/commit/a7612e2e7ebfa6e8a9504c7a56b406984620534f
DIFF: https://github.com/llvm/llvm-project/commit/a7612e2e7ebfa6e8a9504c7a56b406984620534f.diff

LOG: [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:
https://github.com/llvm/llvm-project/issues/65946.

Added: 
    

Modified: 
    llvm/include/llvm/CodeGen/VLIWMachineScheduler.h

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/CodeGen/VLIWMachineScheduler.h b/llvm/include/llvm/CodeGen/VLIWMachineScheduler.h
index bd12baa6afaba67..112ff6df034450d 100644
--- a/llvm/include/llvm/CodeGen/VLIWMachineScheduler.h
+++ b/llvm/include/llvm/CodeGen/VLIWMachineScheduler.h
@@ -165,8 +165,9 @@ class ConvergingVLIWScheduler : public MachineSchedStrategy {
       // a slightly 
diff erent heuristic for small and large functions. For small
       // functions, it's important to use the height/depth of the instruction.
       // For large functions, prioritizing by height or depth increases spills.
-      CriticalPathLength = DAG->getBBSize() / SchedModel->getIssueWidth();
-      if (DAG->getBBSize() < 50)
+      const auto BBSize = DAG->getBBSize();
+      CriticalPathLength = BBSize / SchedModel->getIssueWidth();
+      if (BBSize < 50)
         // We divide by two as a cheap and simple heuristic to reduce the
         // critcal path length, which increases the priority of using the graph
         // height/depth in the scheduler's cost computation.


        


More information about the llvm-commits mailing list