llvm-6502/test/CodeGen/X86/asm-label.ll
Hans Wennborg a421ac689f SelectionDAG switch lowering: Replace unreachable default with most popular case.
This can significantly reduce the size of the switch, allowing for more
efficient lowering.

I also worked with the idea of exploiting unreachable defaults by
omitting the range check for jump tables, but always ended up with a
non-neglible binary size increase. It might be worth looking into some more.

SimplifyCFG currently does this transformation, but I'm working towards changing
that so we can optimize harder based on unreachable defaults.

Differential Revision: http://reviews.llvm.org/D6510

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@223566 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-06 01:28:50 +00:00

41 lines
1.3 KiB
LLVM

; RUN: llc -mtriple=x86_64-apple-darwin10 -O0 < %s | FileCheck %s
; test that we print a label that we use. We had a bug where
; we would print the jump, but not the label because it was considered
; a fall through.
; CHECK: jmp LBB0_9
; CHECK: LBB0_9: ## %cleanup
define void @foo() {
entry:
br i1 undef, label %land.lhs.true, label %if.end11
land.lhs.true: ; preds = %entry
br i1 undef, label %if.then, label %if.end11
if.then: ; preds = %land.lhs.true
br i1 undef, label %if.then9, label %if.end
if.then9: ; preds = %if.then
br label %cleanup
if.end: ; preds = %if.then
br label %cleanup
cleanup: ; preds = %if.end, %if.then9
switch i32 undef, label %default [
i32 0, label %cleanup.cont
i32 1, label %if.end11
]
cleanup.cont: ; preds = %cleanup
br label %if.end11
if.end11: ; preds = %cleanup.cont, %cleanup, %land.lhs.true, %entry
ret void
default: ; preds = %cleanup
br label %if.end11
}