Add a flag to experiment with outlining optional branches.
authorDaniel Jasper <djasper@google.com>
Wed, 4 Mar 2015 11:05:34 +0000 (11:05 +0000)
committerDaniel Jasper <djasper@google.com>
Wed, 4 Mar 2015 11:05:34 +0000 (11:05 +0000)
commitf68f28a41d5e83deb175d180cac7ee55a3914364
tree2e35a501d3e042753c69183225e42ab932fdf3f2
parent78c4ef5120290311f336c4a355e2ff3c583609ae
Add a flag to experiment with outlining optional branches.

In a CFG with the edges A->B->C and A->C, B is an optional branch.

LLVM's default behavior is to lay the blocks out naturally, i.e. A, B,
C, in order to improve code locality and fallthroughs. However, if a
function contains many of those optional branches only a few of which
are taken, this leads to a lot of unnecessary icache misses. Moving B
out of line can work around this.

Review: http://reviews.llvm.org/D7719

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@231230 91177308-0d34-0410-b5e6-96231b3b80d8
lib/CodeGen/MachineBlockPlacement.cpp
test/CodeGen/X86/code_placement_outline_optional_branches.ll [new file with mode: 0644]