blob: 01c8a6bd8653e5bd05c259f2a5d548fe243485f6 [file] [log] [blame]
Michael Gottesman2253a2f2013-06-27 00:25:01 +00001
2; Make sure that llvm-as/llvm-dis properly assembly/disassembly the 'builtin'
3; attribute.
4;
5; rdar://13727199
6
7; RUN: llvm-as -disable-verify < %s | \
Rafael Espindola5b445862013-07-03 16:27:55 +00008; RUN: llvm-dis | \
9; RUN: llvm-as -disable-verify | \
10; RUN: llvm-dis | \
Tim Northoverdcef6a72013-08-12 12:43:26 +000011; RUN: FileCheck -check-prefix=CHECK-ASSEMBLES %s
Michael Gottesman2253a2f2013-06-27 00:25:01 +000012
13; CHECK-ASSEMBLES: declare i8* @foo(i8*) [[NOBUILTIN:#[0-9]+]]
14; CHECK-ASSEMBLES: call i8* @foo(i8* %x) [[BUILTIN:#[0-9]+]]
15; CHECK-ASSEMBLES: attributes [[NOBUILTIN]] = { nobuiltin }
16; CHECK-ASSEMBLES: attributes [[BUILTIN]] = { builtin }
17
18declare i8* @foo(i8*) #1
19define i8* @bar(i8* %x) {
20 %y = call i8* @foo(i8* %x) #0
21 ret i8* %y
22}
23
24; Make sure that we do not accept the 'builtin' attribute on function
25; definitions, function declarations, and on call sites that call functions
26; which do not have nobuiltin on them.
27; rdar://13727199
28
Tim Northoverdcef6a72013-08-12 12:43:26 +000029; RUN: not llvm-as <%s 2>&1 | FileCheck -check-prefix=CHECK-BAD %s
Michael Gottesman2253a2f2013-06-27 00:25:01 +000030
Michael Gottesman2253a2f2013-06-27 00:25:01 +000031; CHECK-BAD: Attribute 'builtin' can only be applied to a callsite.
32; CHECK-BAD-NEXT: i8* (i8*)* @car
33; CHECK-BAD: Attribute 'builtin' can only be applied to a callsite.
34; CHECK-BAD-NEXT: i8* (i8*)* @mar
35
36declare i8* @lar(i8*)
37
38define i8* @har(i8* %x) {
39 %y = call i8* @lar(i8* %x) #0
40 ret i8* %y
41}
42
43define i8* @car(i8* %x) #0 {
44 ret i8* %x
45}
46
47declare i8* @mar(i8*) #0
48
49attributes #0 = { builtin }
50attributes #1 = { nobuiltin }