1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-24 05:23:45 +02:00
llvm-mirror/test/CodeGen/X86/jump_table_alias.ll
Rafael Espindola 9f2d511fe1 Use "weak alias" instead of "alias weak"
Before this patch we had

@a = weak global ...
but
@b = alias weak ...

The patch changes aliases to look more like global variables.

Looking at some really old code suggests that the reason was that the old
bison based parser had a reduction for alias linkages and another one for
global variable linkages. Putting the alias first avoided the reduce/reduce
conflict.

The days of the old .ll parser are long gone. The new one parses just "linkage"
and a later check is responsible for deciding if a linkage is valid in a
given context.

llvm-svn: 214355
2014-07-30 22:51:54 +00:00

34 lines
927 B
LLVM

; RUN: llc <%s -jump-table-type=single | FileCheck %s
target triple = "x86_64-unknown-linux-gnu"
define i32 @f() unnamed_addr jumptable {
entry:
ret i32 0
}
@i = internal alias i32 ()* @f
@j = alias i32 ()* @f
define i32 @main(i32 %argc, i8** %argv) {
%temp = alloca i32 ()*, align 8
store i32 ()* @i, i32()** %temp, align 8
; CHECK: movq $__llvm_jump_instr_table_0_1
%1 = load i32 ()** %temp, align 8
; CHECK: movl $__llvm_jump_instr_table_0_1
%2 = call i32 ()* %1()
%3 = call i32 ()* @i()
; CHECK: callq i
%4 = call i32 ()* @j()
; CHECK: callq j
ret i32 %3
}
; There should only be one table, even though there are two GlobalAliases,
; because they both alias the same value.
; CHECK: .globl __llvm_jump_instr_table_0_1
; CHECK: .align 8, 0x90
; CHECK: .type __llvm_jump_instr_table_0_1,@function
; CHECK: __llvm_jump_instr_table_0_1:
; CHECK: jmp f@PLT