diff options
Diffstat (limited to 'lib/CodeGen/IfConversion.cpp')
-rw-r--r-- | lib/CodeGen/IfConversion.cpp | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/lib/CodeGen/IfConversion.cpp b/lib/CodeGen/IfConversion.cpp index f0e8c4775c..b664b3b191 100644 --- a/lib/CodeGen/IfConversion.cpp +++ b/lib/CodeGen/IfConversion.cpp @@ -1180,12 +1180,14 @@ bool IfConverter::IfConvertTriangle(BBInfo &BBI, IfcvtKind Kind) { DontKill.clear(); bool HasEarlyExit = CvtBBI->FalseBB != NULL; - uint64_t CvtNext = 0, CvtFalse = 0, SumWeight = 0; + uint64_t CvtNext = 0, CvtFalse = 0, BBNext = 0, BBCvt = 0, SumWeight = 0; uint32_t WeightScale = 0; if (HasEarlyExit) { - // Get weights before modifying CvtBBI->BB. + // Get weights before modifying CvtBBI->BB and BBI.BB. CvtNext = MBPI->getEdgeWeight(CvtBBI->BB, NextBBI->BB); CvtFalse = MBPI->getEdgeWeight(CvtBBI->BB, CvtBBI->FalseBB); + BBNext = MBPI->getEdgeWeight(BBI.BB, NextBBI->BB); + BBCvt = MBPI->getEdgeWeight(BBI.BB, CvtBBI->BB); SumWeight = MBPI->getSumForBlock(CvtBBI->BB, WeightScale); } if (CvtBBI->BB->pred_size() > 1) { @@ -1222,9 +1224,6 @@ bool IfConverter::IfConvertTriangle(BBInfo &BBI, IfcvtKind Kind) { // New_Weight(BBI.BB, CvtBBI->FalseBB) = // Weight(BBI.BB, CvtBBI->BB) * Weight(CvtBBI->BB, CvtBBI->FalseBB) - uint64_t BBNext = MBPI->getEdgeWeight(BBI.BB, NextBBI->BB); - uint64_t BBCvt = MBPI->getEdgeWeight(BBI.BB, CvtBBI->BB); - uint64_t NewNext = BBNext * SumWeight + (BBCvt * CvtNext) / WeightScale; uint64_t NewFalse = (BBCvt * CvtFalse) / WeightScale; // We need to scale down all weights of BBI.BB to fit uint32_t. |