Fixes priority queue ordering in llvm-flo block reordering

Summary:
Fixes a bug which caused the block reordering heuristic to put in the
same cluster hot basic blocks and cold basic blocks, increasing I-cache misses.

(cherry picked from FBD2588203)
This commit is contained in:
Rafael Auler
2015-10-27 03:04:58 -07:00
committed by Maksim Panchenko
parent d4d773458c
commit 2539539bde

View File

@@ -590,7 +590,7 @@ void BinaryFunction::optimizeLayout() {
std::map<EdgeTy, uint64_t> Weight;
// Define a comparison function to establish SWO between edges
auto Comp = [&Weight](EdgeTy A, EdgeTy B) { return Weight[A] > Weight[B]; };
auto Comp = [&Weight](EdgeTy A, EdgeTy B) { return Weight[A] < Weight[B]; };
std::priority_queue<EdgeTy, std::vector<EdgeTy>, decltype(Comp)> Queue(Comp);
typedef std::vector<BinaryBasicBlock *> ClusterTy;