Commit 43f06ca
authored
[TIR] Avoid re-defining
Prior to this commit, `ArgBinder` would always introduce a new
variable to represent the input argument, even if the argument already
a primitive type. This introduces trivial let bindings that are
expected to be simplified out, but which can produce dangling
`tir::Var` usage in some cases (see
#14951).
This commit updates `ArgBinder` to prefer using the original
`tir::Var` when possible. That is, when a function takes `n: T.int32`
as input, the packed function should produce a binding `n: T.int32 =
T.tvm_struct_get(...)`, rather than producing a binding `arg_n =
T.tvm_struct_get(...)` followed by `n = arg_n`.var = arg_var in ArgBinder (#14952)1 parent 94c1b89 commit 43f06ca
File tree
2 files changed
+16
-33
lines changed- src/tir/transforms
- tests/python/unittest
2 files changed
+16
-33
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
262 | 262 | | |
263 | 263 | | |
264 | 264 | | |
265 | | - | |
266 | | - | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
267 | 268 | | |
268 | 269 | | |
269 | 270 | | |
270 | 271 | | |
271 | | - | |
272 | | - | |
273 | | - | |
274 | | - | |
275 | | - | |
276 | | - | |
277 | | - | |
278 | | - | |
279 | | - | |
280 | | - | |
281 | | - | |
282 | | - | |
283 | 272 | | |
284 | 273 | | |
285 | 274 | | |
| |||
288 | 277 | | |
289 | 278 | | |
290 | 279 | | |
| 280 | + | |
291 | 281 | | |
292 | | - | |
293 | | - | |
294 | | - | |
| 282 | + | |
295 | 283 | | |
296 | 284 | | |
297 | | - | |
298 | | - | |
299 | 285 | | |
300 | | - | |
| 286 | + | |
301 | 287 | | |
302 | 288 | | |
303 | | - | |
| 289 | + | |
304 | 290 | | |
305 | 291 | | |
306 | 292 | | |
| |||
330 | 316 | | |
331 | 317 | | |
332 | 318 | | |
333 | | - | |
334 | | - | |
| 319 | + | |
| 320 | + | |
335 | 321 | | |
336 | 322 | | |
337 | 323 | | |
| |||
Lines changed: 7 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
101 | 101 | | |
102 | 102 | | |
103 | 103 | | |
104 | | - | |
| 104 | + | |
105 | 105 | | |
106 | 106 | | |
107 | | - | |
108 | | - | |
109 | | - | |
110 | | - | |
111 | | - | |
| 107 | + | |
| 108 | + | |
112 | 109 | | |
113 | 110 | | |
114 | 111 | | |
115 | | - | |
| 112 | + | |
116 | 113 | | |
117 | 114 | | |
118 | 115 | | |
| |||
147 | 144 | | |
148 | 145 | | |
149 | 146 | | |
150 | | - | |
| 147 | + | |
151 | 148 | | |
152 | 149 | | |
153 | | - | |
154 | | - | |
| 150 | + | |
| 151 | + | |
155 | 152 | | |
156 | 153 | | |
157 | 154 | | |
| |||
0 commit comments