@@ -74,20 +74,51 @@ func.func @inline_with_multi_return() -> i32 {
74
74
}
75
75
76
76
// 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 {
78
83
%b = arith.addi %c , %c : i32 loc (" mysource.cc" :10 :8 )
79
84
return %b : i32 loc (" mysource.cc" :11 :2 )
80
85
}
81
86
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 {
84
95
// 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 )
86
97
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
89
105
}
90
106
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
+ }
91
122
92
123
// Check that external function declarations are not inlined.
93
124
func.func private @func_external ()
0 commit comments