| ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 6 | |
| ;; Check that -basic-block-address-map-emit-func-guid emits the function GUID in | |
| ;; the SHT_LLVM_BB_ADDR_MAP section, only for functions with local linkage. | |
| ; RUN: llc < %s -mtriple=x86_64 -function-sections -basic-block-address-map -basic-block-address-map-emit-func-guid | FileCheck %s | |
| ;; Check that the GUIDs are correctly decoded from the object file. | |
| ; RUN: llc < %s -mtriple=x86_64 -function-sections -basic-block-address-map -basic-block-address-map-emit-func-guid -filetype=obj -o %t.o | |
| ; RUN: llvm-readobj --bb-addr-map %t.o | FileCheck %s --check-prefix=READOBJ | |
| source_filename = "a.c" | |
| ;; No GUID is emitted for functions with non-local linkage, even if one is | |
| ;; assigned, since they can be identified by their symbol names. | |
| define void @foo() !guid !0 { | |
| ; CHECK-LABEL: foo: | |
| ; CHECK: # %bb.0: | |
| ; CHECK-NEXT: retq | |
| ; CHECK-NEXT: .LBB_END0_0: | |
| ret void | |
| } | |
| ; CHECK: .section .llvm_bb_addr_map,"o",@llvm_bb_addr_map,.text.foo{{$}} | |
| ; CHECK-NEXT: .byte 6 # version | |
| ; CHECK-NEXT: .short 0 # feature | |
| ; CHECK-NEXT: .quad .Lfunc_begin0 # function address | |
| ;; For functions with local linkage, the assigned GUID is emitted. | |
| define internal void @bar() !guid !1 { | |
| ; CHECK-LABEL: bar: | |
| ; CHECK: # %bb.0: | |
| ; CHECK-NEXT: retq | |
| ; CHECK-NEXT: .LBB_END1_0: | |
| ret void | |
| } | |
| ; CHECK: .section .llvm_bb_addr_map,"o",@llvm_bb_addr_map,.text.bar{{$}} | |
| ; CHECK-NEXT: .byte 6 # version | |
| ; CHECK-NEXT: .short 256 # feature | |
| ; CHECK-NEXT: .quad 1311768467463790320 # function GUID | |
| ; CHECK-NEXT: .quad .Lfunc_begin1 # function address | |
| ;; If no GUID is assigned, it is computed from the module's source file name and | |
| ;; the function's name, i.e., MD5("a.c;baz"). | |
| define internal void @baz() { | |
| ; CHECK-LABEL: baz: | |
| ; CHECK: # %bb.0: | |
| ; CHECK-NEXT: retq | |
| ; CHECK-NEXT: .LBB_END2_0: | |
| ret void | |
| } | |
| ; CHECK: .section .llvm_bb_addr_map,"o",@llvm_bb_addr_map,.text.baz{{$}} | |
| ; CHECK-NEXT: .byte 6 # version | |
| ; CHECK-NEXT: .short 256 # feature | |
| ; CHECK-NEXT: .quad 8706860123593626477 # function GUID | |
| ; CHECK-NEXT: .quad .Lfunc_begin2 # function address | |
| !0 = !{i64 1111} | |
| !1 = !{i64 1311768467463790320} | |
| ; READOBJ: Name: foo | |
| ; READOBJ-NEXT: BB Ranges [ | |
| ; READOBJ: Name: bar | |
| ; READOBJ-NEXT: GUID: 0x123456789ABCDEF0 | |
| ; READOBJ-NEXT: BB Ranges [ | |
| ; READOBJ: Name: baz | |
| ; READOBJ-NEXT: GUID: 0x78D4FB26C7CFD36D | |
| ; READOBJ-NEXT: BB Ranges [ |