Assign weights to edges to jump table / bit test header when lowering switch statement.
authorCong Hou <congh@google.com>
Wed, 26 Aug 2015 23:15:32 +0000 (23:15 +0000)
committerCong Hou <congh@google.com>
Wed, 26 Aug 2015 23:15:32 +0000 (23:15 +0000)
commit6dc18d8d3a86509edf747a3cddcc0104ef710cc3
tree8365ac89fdd8479ac172cbca1c29d6262fdc2d6e
parent304aa0291287b6146791f986b7e2217701394d04
Assign weights to edges to jump table / bit test header when lowering switch statement.

Currently, when lowering switch statement and a new basic block is built for jump table / bit test header, the edge to this new block is not assigned with a correct weight. This patch collects the edge weight from all its successors and assign this sum of weights to the edge (and also the other fall-through edge). Test cases are adjusted accordingly.

Differential Revision: http://reviews.llvm.org/D12166#fae6eca7

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@246104 91177308-0d34-0410-b5e6-96231b3b80d8
lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
lib/CodeGen/SelectionDAG/SelectionDAGBuilder.h
test/CodeGen/ARM/jump-table-islands.ll
test/CodeGen/Mips/nacl-align.ll
test/CodeGen/X86/switch-jump-table.ll
test/CodeGen/X86/switch.ll
test/CodeGen/X86/x86-shrink-wrapping.ll