[llvm-commits] [llvm] r163926 - /llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp
Manman Ren
mren at apple.com
Fri Sep 14 12:05:19 PDT 2012
Author: mren
Date: Fri Sep 14 14:05:19 2012
New Revision: 163926
URL: http://llvm.org/viewvc/llvm-project?rev=163926&view=rev
Log:
Try to fix the bots by detecting inconsistant branch-weight metadata.
Modified:
llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp
Modified: llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp?rev=163926&r1=163925&r2=163926&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp (original)
+++ llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp Fri Sep 14 14:05:19 2012
@@ -830,18 +830,24 @@
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) {
More information about the llvm-commits
mailing list