1 // RUN: mlir-opt %s -inline -split-input-file | FileCheck %s
3 #di_file = #llvm.di_file<"file.mlir" in "/">
5 // CHECK: #[[START_ORIGINAL:.*]] = loc({{.*}}:42
6 #loc1 = loc("test.mlir":42:4)
7 // CHECK: #[[END_ORIGINAL:.*]] = loc({{.*}}:52
8 #loc2 = loc("test.mlir":52:4)
9 #loc3 = loc("test.mlir":62:4)
10 // CHECK: #[[CALL_ORIGINAL:.*]] = loc({{.*}}:72
11 #loc4 = loc("test.mlir":72:4)
13 #di_compile_unit = #llvm.di_compile_unit<id = distinct[0]<>, sourceLanguage = DW_LANG_C, file = #di_file, isOptimized = false, emissionKind = None>
14 // CHECK: #[[CALLEE_DI:.*]] = #llvm.di_subprogram<{{.*}}, name = "callee"
15 #di_subprogram_callee = #llvm.di_subprogram<compileUnit = #di_compile_unit, scope = #di_file, name = "callee", file = #di_file, subprogramFlags = Definition>
17 // CHECK: #[[CALLER_DI:.*]] = #llvm.di_subprogram<{{.*}}, name = "caller"
18 #di_subprogram_caller = #llvm.di_subprogram<compileUnit = #di_compile_unit, scope = #di_file, name = "caller", file = #di_file, subprogramFlags = Definition>
20 // CHECK: #[[START_FUSED_ORIGINAL:.*]] = loc(fused<#[[CALLEE_DI]]>[#[[START_ORIGINAL]]
21 #start_loc_fused = loc(fused<#di_subprogram_callee>[#loc1])
22 // CHECK: #[[END_FUSED_ORIGINAL:.*]] = loc(fused<#[[CALLEE_DI]]>[#[[END_ORIGINAL]]
23 #end_loc_fused= loc(fused<#di_subprogram_callee>[#loc2])
24 #caller_loc= loc(fused<#di_subprogram_caller>[#loc3])
25 // CHECK: #[[CALL_FUSED:.*]] = loc(fused<#[[CALLER_DI]]>[#[[CALL_ORIGINAL]]
26 #call_loc= loc(fused<#di_subprogram_caller>[#loc4])
28 #loopMD = #llvm.loop_annotation<
29 startLoc = #start_loc_fused,
30 endLoc = #end_loc_fused>
32 // CHECK: #[[START_CALLSITE_LOC:.*]] = loc(callsite(#[[START_FUSED_ORIGINAL]] at #[[CALL_FUSED]]
33 // CHECK: #[[END_CALLSITE_LOC:.*]] = loc(callsite(#[[END_FUSED_ORIGINAL]] at #[[CALL_FUSED]]
34 // CHECK: #[[START_FUSED_LOC:.*]] = loc(fused<#[[CALLER_DI]]>[#[[START_CALLSITE_LOC]]
35 // CHECK: #[[END_FUSED_LOC:.*]] = loc(fused<#[[CALLER_DI]]>[
36 // CHECK: #[[LOOP_ANNOT:.*]] = #llvm.loop_annotation<
37 // CHECK-SAME: startLoc = #[[START_FUSED_LOC]], endLoc = #[[END_FUSED_LOC]]>
39 llvm.func @cond() -> i1
44 %c = llvm.call @cond() : () -> i1
45 llvm.cond_br %c, ^head, ^exit {loop_annotation = #loopMD}
50 // CHECK: @loop_annotation
51 llvm.func @loop_annotation() {
52 // CHECK: llvm.cond_br
53 // CHECK-SAME: {loop_annotation = #[[LOOP_ANNOT]]
54 llvm.call @callee() : () -> () loc(#call_loc)