[PATCH] [MachineSink+PGO] Teach MachineSink to use BlockFrequencyInfo

Quentin Colombet qcolombet at apple.com
Wed Sep 24 12:21:09 PDT 2014


================
Comment at: lib/CodeGen/MachineSink.cpp:259
@@ -249,2 +258,3 @@
   LI = &getAnalysis<MachineLoopInfo>();
+  MBFI = &getAnalysis<MachineBlockFrequencyInfo>();
   AA = &getAnalysis<AliasAnalysis>();
----------------
Should we still grab this analysis if UseBlockFreqInfo is false?

================
Comment at: lib/CodeGen/MachineSink.cpp:587
@@ -575,2 +586,3 @@
           [this](const MachineBasicBlock *LHS, const MachineBasicBlock *RHS) {
-            return LI->getLoopDepth(LHS) < LI->getLoopDepth(RHS);
+            uint64_t LHSFreq = MBFI->getBlockFreq(LHS).getFrequency();
+            uint64_t RHSFreq = MBFI->getBlockFreq(RHS).getFrequency();
----------------
If we do not grab the analysis when UseBlockFreqInfo is false, this should be adapted.

================
Comment at: test/CodeGen/X86/sink-blockfreq.ll:1
@@ +1,2 @@
+; RUN: llc -disable-machine-licm -mtriple=x86_64-apple-darwin < %s | FileCheck %s -check-prefix=MSINK_BFI
+; RUN: llc -disable-machine-licm -machine-sink-bfi=false -mtriple=x86_64-apple-darwin < %s | FileCheck %s -check-prefix=MSINK_NOBFI
----------------
Put -machine-sink-bfi=true on the run line. Although this is not required, I like being explicit with what we test.

http://reviews.llvm.org/D5447






More information about the llvm-commits mailing list