summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
diff options
context:
space:
mode:
authorCong Hou <congh@google.com>2015-09-23 00:20:27 +0000
committerCong Hou <congh@google.com>2015-09-23 00:20:27 +0000
commit9def6efd7e3019d5a73705999da51f4d2195809c (patch)
treeba2dd1e8b6cec5cf98a85bfa23862934fcdaf316 /llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
parentca6f044f35ecbe703364a36a0509873587e858ea (diff)
downloadbcm5719-llvm-9def6efd7e3019d5a73705999da51f4d2195809c.tar.gz
bcm5719-llvm-9def6efd7e3019d5a73705999da51f4d2195809c.zip
Fixed an issue on updating profile data when lowering switch statement.
Fixed the issue that when there is an edge from the jump table to the default statement, we should check it directly instead of checking if the sibling of the jump table header is a successor of the jump table header, which may not be the default statment but a successor of it. llvm-svn: 248354
Diffstat (limited to 'llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp')
-rw-r--r--llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
index 44f222aeafd..97caa9d014a 100644
--- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
@@ -8146,13 +8146,13 @@ void SelectionDAGBuilder::lowerWorkItem(SwitchWorkListItem W, Value *Cond,
uint32_t JumpWeight = I->Weight;
uint32_t FallthroughWeight = UnhandledWeights;
- // If Fallthrough is a target of the jump table, we evenly distribute
- // the weight on the edge to Fallthrough to successors of CurMBB.
- // Also update the weight on the edge from JumpMBB to Fallthrough.
+ // If the default statement is a target of the jump table, we evenly
+ // distribute the default weight to successors of CurMBB. Also update
+ // the weight on the edge from JumpMBB to Fallthrough.
for (MachineBasicBlock::succ_iterator SI = JumpMBB->succ_begin(),
SE = JumpMBB->succ_end();
SI != SE; ++SI) {
- if (*SI == Fallthrough) {
+ if (*SI == DefaultMBB) {
JumpWeight += DefaultWeight / 2;
FallthroughWeight -= DefaultWeight / 2;
JumpMBB->setSuccWeight(SI, DefaultWeight / 2);
OpenPOWER on IntegriCloud