@@ -74,20 +74,51 @@ func.func @inline_with_multi_return() -> i32 {
7474}
7575
7676// Check that location information is updated for inlined instructions.
77- func.func @func_with_locations (%c : i32 ) -> i32 {
77+
78+ #inline_stack1 = loc (callsite (" mysource1.cc" :10 :8 at callsite (" mysource2.cc" :13 :6 at " mysource3.cc" :16 :2 )))
79+ #inline_stack2 = loc (callsite (" mysource4.cc" :55 :4 at callsite (" mysource5.cc" :25 :8 at " mysource6.cc" :32 :4 )))
80+
81+ // INLINE-LOC-LABEL: func @func_with_file_locations
82+ func.func @func_with_file_locations (%c : i32 ) -> i32 {
7883 %b = arith.addi %c , %c : i32 loc (" mysource.cc" :10 :8 )
7984 return %b : i32 loc (" mysource.cc" :11 :2 )
8085}
8186
82- // INLINE-LOC-LABEL: func @inline_with_locations
83- func.func @inline_with_locations (%arg0 : i32 ) -> i32 {
87+ // INLINE-LOC-LABEL: func @func_with_callsite_locations
88+ func.func @func_with_callsite_locations (%c : i32 ) -> i32 {
89+ %b = arith.addi %c , %c : i32 loc (#inline_stack1 )
90+ return %b : i32 loc (#inline_stack1 )
91+ }
92+
93+ // INLINE-LOC-LABEL: func @inline_func_with_file_locations
94+ func.func @inline_func_with_file_locations (%arg0 : i32 ) -> i32 {
8495 // INLINE-LOC-NEXT: arith.addi %{{.*}}, %{{.*}} : i32 loc(callsite("mysource.cc":10:8 at "mysource.cc":55:14))
85- // INLINE-LOC-NEXT: return
96+ %0 = call @func_with_file_locations ( %arg0 ) : ( i32 ) -> i32 loc ( " mysource.cc " : 55 : 14 )
8697
87- %0 = call @func_with_locations (%arg0 ) : (i32 ) -> i32 loc (" mysource.cc" :55 :14 )
88- return %0 : i32
98+ // INLINE-LOC-NEXT: arith.addi %{{.*}}, %{{.*}} : i32
99+ // INLINE-LOC-SAME: loc(callsite("mysource.cc":10:8 at callsite("mysource1.cc":10:8 at callsite("mysource2.cc":13:6
100+ // INLINE-LOC-SAME: at "mysource3.cc":16:2))))
101+ %1 = call @func_with_file_locations (%0 ) : (i32 ) -> i32 loc (#inline_stack1 )
102+
103+ // INLINE-LOC-NEXT: return
104+ return %1 : i32
89105}
90106
107+ // INLINE-LOC-LABEL: func @inline_func_with_callsite_locations
108+ func.func @inline_func_with_callsite_locations (%arg0 : i32 ) -> i32 {
109+ // INLINE-LOC-NEXT: arith.addi %{{.*}}, %{{.*}} : i32
110+ // INLINE-LOC-SAME: loc(callsite("mysource1.cc":10:8 at callsite("mysource2.cc":13:6 at callsite("mysource3.cc":16:2
111+ // INLINE-LOC-SAME: at "mysource.cc":10:8))))
112+ %0 = call @func_with_callsite_locations (%arg0 ) : (i32 ) -> i32 loc (" mysource.cc" :10 :8 )
113+
114+ // INLINE-LOC-NEXT: arith.addi %{{.*}}, %{{.*}} : i32
115+ // INLINE-LOC-SAME: loc(callsite("mysource1.cc":10:8 at callsite("mysource2.cc":13:6 at callsite("mysource3.cc":16:2
116+ // INLINE-LOC-SAME: at callsite("mysource4.cc":55:4 at callsite("mysource5.cc":25:8 at "mysource6.cc":32:4))))))
117+ %1 = call @func_with_callsite_locations (%0 ) : (i32 ) -> i32 loc (#inline_stack2 )
118+
119+ // INLINE-LOC-NEXT: return
120+ return %1 : i32
121+ }
91122
92123// Check that external function declarations are not inlined.
93124func.func private @func_external ()
0 commit comments