blob: 463dc3f35e733042e489e7116ad4cf53c05a5a46 [file] [log] [blame]
Tom Roeder44cb65f2014-06-05 19:29:43 +00001; RUN: llc <%s -jump-table-type=single | FileCheck %s
2target triple = "x86_64-unknown-linux-gnu"
3define i32 @f() unnamed_addr jumptable {
4entry:
5 ret i32 0
6}
7
Rafael Espindola464fe022014-07-30 22:51:54 +00008@i = internal alias i32 ()* @f
Tom Roeder44cb65f2014-06-05 19:29:43 +00009@j = alias i32 ()* @f
10
11define i32 @main(i32 %argc, i8** %argv) {
12 %temp = alloca i32 ()*, align 8
13 store i32 ()* @i, i32()** %temp, align 8
14; CHECK: movq $__llvm_jump_instr_table_0_1
15 %1 = load i32 ()** %temp, align 8
16; CHECK: movl $__llvm_jump_instr_table_0_1
17 %2 = call i32 ()* %1()
18 %3 = call i32 ()* @i()
19; CHECK: callq i
20 %4 = call i32 ()* @j()
21; CHECK: callq j
22 ret i32 %3
23}
24
25; There should only be one table, even though there are two GlobalAliases,
26; because they both alias the same value.
27
28; CHECK: .globl __llvm_jump_instr_table_0_1
29; CHECK: .align 8, 0x90
30; CHECK: .type __llvm_jump_instr_table_0_1,@function
31; CHECK: __llvm_jump_instr_table_0_1:
32; CHECK: jmp f@PLT
33