attribute-builtin.ll 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. ; Make sure that llvm-as/llvm-dis properly assembly/disassembly the 'builtin'
  2. ; attribute.
  3. ;
  4. ; rdar://13727199
  5. ; RUN: llvm-as -disable-verify < %s | \
  6. ; RUN: llvm-dis | \
  7. ; RUN: llvm-as -disable-verify | \
  8. ; RUN: llvm-dis | \
  9. ; RUN: FileCheck -check-prefix=CHECK-ASSEMBLES %s
  10. ; CHECK-ASSEMBLES: declare i8* @foo(i8*) [[NOBUILTIN:#[0-9]+]]
  11. ; CHECK-ASSEMBLES: call i8* @foo(i8* %x) [[BUILTIN:#[0-9]+]]
  12. ; CHECK-ASSEMBLES: attributes [[NOBUILTIN]] = { nobuiltin }
  13. ; CHECK-ASSEMBLES: attributes [[BUILTIN]] = { builtin }
  14. declare i8* @foo(i8*) #1
  15. define i8* @bar(i8* %x) {
  16. %y = call i8* @foo(i8* %x) #0
  17. ret i8* %y
  18. }
  19. ; Make sure that we do not accept the 'builtin' attribute on function
  20. ; definitions, function declarations, and on call sites that call functions
  21. ; which do not have nobuiltin on them.
  22. ; rdar://13727199
  23. ; RUN: not llvm-as <%s 2>&1 | FileCheck -check-prefix=CHECK-BAD %s
  24. ; CHECK-BAD: Attribute 'builtin' can only be applied to a callsite.
  25. ; CHECK-BAD-NEXT: i8* (i8*)* @car
  26. ; CHECK-BAD: Attribute 'builtin' can only be applied to a callsite.
  27. ; CHECK-BAD-NEXT: i8* (i8*)* @mar
  28. declare i8* @lar(i8*)
  29. define i8* @har(i8* %x) {
  30. %y = call i8* @lar(i8* %x) #0
  31. ret i8* %y
  32. }
  33. define i8* @car(i8* %x) #0 {
  34. ret i8* %x
  35. }
  36. declare i8* @mar(i8*) #0
  37. attributes #0 = { builtin }
  38. attributes #1 = { nobuiltin }