[llvm-commits] [llvm] r143190 - /llvm/trunk/lib/CodeGen/MachineBranchProbabilityInfo.cpp
Benjamin Kramer
benny.kra at googlemail.com
Fri Oct 28 04:14:31 PDT 2011
Author: d0k
Date: Fri Oct 28 06:14:31 2011
New Revision: 143190
URL: http://llvm.org/viewvc/llvm-project?rev=143190&view=rev
Log:
Use BranchProbability compare operators.
Modified:
llvm/trunk/lib/CodeGen/MachineBranchProbabilityInfo.cpp
Modified: llvm/trunk/lib/CodeGen/MachineBranchProbabilityInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineBranchProbabilityInfo.cpp?rev=143190&r1=143189&r2=143190&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/MachineBranchProbabilityInfo.cpp (original)
+++ llvm/trunk/lib/CodeGen/MachineBranchProbabilityInfo.cpp Fri Oct 28 06:14:31 2011
@@ -55,12 +55,8 @@
bool MachineBranchProbabilityInfo::isEdgeHot(MachineBasicBlock *Src,
MachineBasicBlock *Dst) const {
// Hot probability is at least 4/5 = 80%
- uint32_t Weight = getEdgeWeight(Src, Dst);
- uint32_t Sum = getSumForBlock(Src);
-
- // FIXME: Implement BranchProbability::compare then change this code to
- // compare this BranchProbability against a static "hot" BranchProbability.
- return (uint64_t)Weight * 5 > (uint64_t)Sum * 4;
+ // FIXME: Compare against a static "hot" BranchProbability.
+ return getEdgeProbability(Src, Dst) > BranchProbability(4, 5);
}
MachineBasicBlock *
@@ -84,8 +80,7 @@
}
}
- // FIXME: Use BranchProbability::compare.
- if ((uint64_t)MaxWeight * 5 >= (uint64_t)Sum * 4)
+ if (BranchProbability(MaxWeight, Sum) >= BranchProbability(4, 5))
return MaxSucc;
return 0;
More information about the llvm-commits
mailing list