51 lines · plain
1 2; Make sure that llvm-as/llvm-dis properly assembly/disassembly the 'builtin'3; attribute.4;5; rdar://137271996 7; RUN: llvm-as -disable-verify < %s | \8; RUN: llvm-dis | \9; RUN: llvm-as -disable-verify | \10; RUN: llvm-dis | \11; RUN: FileCheck -check-prefix=CHECK-ASSEMBLES %s12 13; CHECK-ASSEMBLES: declare ptr @foo(ptr) [[NOBUILTIN:#[0-9]+]]14; CHECK-ASSEMBLES: call ptr @foo(ptr %x) [[BUILTIN:#[0-9]+]]15; CHECK-ASSEMBLES: attributes [[NOBUILTIN]] = { nobuiltin }16; CHECK-ASSEMBLES: attributes [[BUILTIN]] = { builtin }17 18declare ptr @foo(ptr) #119define ptr @bar(ptr %x) {20 %y = call ptr @foo(ptr %x) #021 ret ptr %y22}23 24; Make sure that we do not accept the 'builtin' attribute on function25; definitions, function declarations, and on call sites that call functions26; which do not have nobuiltin on them.27; rdar://1372719928 29; RUN: not llvm-as <%s 2>&1 | FileCheck -check-prefix=CHECK-BAD %s30 31; CHECK-BAD: Attribute 'builtin' can only be applied to a callsite.32; CHECK-BAD-NEXT: ptr @car33; CHECK-BAD: Attribute 'builtin' can only be applied to a callsite.34; CHECK-BAD-NEXT: ptr @mar35 36declare ptr @lar(ptr)37 38define ptr @har(ptr %x) {39 %y = call ptr @lar(ptr %x) #040 ret ptr %y41}42 43define ptr @car(ptr %x) #0 {44 ret ptr %x45}46 47declare ptr @mar(ptr) #048 49attributes #0 = { builtin }50attributes #1 = { nobuiltin }51