diff options
author | Manman Ren <mren@apple.com> | 2012-09-14 19:05:19 +0000 |
---|---|---|
committer | Manman Ren <mren@apple.com> | 2012-09-14 19:05:19 +0000 |
commit | 5e5049d9a64e918ab807c5d3790491d6b3c94861 (patch) | |
tree | 470c82efa7bf5bea688f9a87f33736bcdb7368e5 /llvm/lib/Transforms/Utils/SimplifyCFG.cpp | |
parent | c87e6903723c94c0e782418d221e5f2af45a53ba (diff) | |
download | bcm5719-llvm-5e5049d9a64e918ab807c5d3790491d6b3c94861.tar.gz bcm5719-llvm-5e5049d9a64e918ab807c5d3790491d6b3c94861.zip |
Try to fix the bots by detecting inconsistant branch-weight metadata.
llvm-svn: 163926
Diffstat (limited to 'llvm/lib/Transforms/Utils/SimplifyCFG.cpp')
-rw-r--r-- | llvm/lib/Transforms/Utils/SimplifyCFG.cpp | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp index 2591dbf7262..551df00a1de 100644 --- a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp +++ b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp @@ -830,18 +830,24 @@ bool SimplifyCFGOpt::FoldValueComparisonIntoPredecessors(TerminatorInst *TI, bool PredHasWeights = HasBranchWeights(PTI); bool SuccHasWeights = HasBranchWeights(TI); - if (PredHasWeights) + if (PredHasWeights) { GetBranchWeights(PTI, Weights); - else if (SuccHasWeights) + // branch-weight metadata is inconsistant here. + if (Weights.size() != 1 + PredCases.size()) + PredHasWeights = SuccHasWeights = false; + } else if (SuccHasWeights) // If there are no predecessor weights but there are successor weights, // populate Weights with 1, which will later be scaled to the sum of // successor's weights Weights.assign(1 + PredCases.size(), 1); SmallVector<uint64_t, 8> SuccWeights; - if (SuccHasWeights) + if (SuccHasWeights) { GetBranchWeights(TI, SuccWeights); - else if (PredHasWeights) + // branch-weight metadata is inconsistant here. + if (SuccWeights.size() != 1 + BBCases.size()) + PredHasWeights = SuccHasWeights = false; + } else if (PredHasWeights) SuccWeights.assign(1 + BBCases.size(), 1); if (PredDefault == BB) { |