Commit eb332ca
Automerge: [mlir][emitc] Support 'emitc::LValueType' in 'emitc::VerbatimOp' (#144151)
This PR introduces support for `emitc::LvalueType` in
`emitc::VerbatimOp`, providing a mechanism to reduce the number of
operations required when working with verbatim operations whose
arguments are of type `emitc::LvalueType`.
Before:
```mlir
emitc.func @foo() {
%a = "emitc.variable"() <{value = #emitc.opaque<"1">}> : () -> !emitc.lvalue<i32>
%loaded_a = load %a : !emitc.lvalue<i32>
emitc.verbatim "{} + {};" args %loaded_a, %loaded_a : i32, i32
return
}
```
After:
```mlir
emitc.func @bar() {
%a = "emitc.variable"() <{value = #emitc.opaque<"1">}> : () -> !emitc.lvalue<i32>
emitc.verbatim "{} + {};" args %a, %a : !emitc.lvalue<i32>, !emitc.lvalue<i32>
return
}
```
You can now write something like this:
```mlir
emitc.func @baz() {
%a = "emitc.variable"() <{value = #emitc.opaque<"1">}> : () -> !emitc.lvalue<i32>
emitc.verbatim "++{};" args %a : !emitc.lvalue<i32>
return
}
```2 files changed
+13
-5
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1304 | 1304 | | |
1305 | 1305 | | |
1306 | 1306 | | |
1307 | | - | |
| 1307 | + | |
1308 | 1308 | | |
1309 | 1309 | | |
1310 | 1310 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
246 | 246 | | |
247 | 247 | | |
248 | 248 | | |
249 | | - | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
250 | 258 | | |
251 | 259 | | |
252 | | - | |
253 | | - | |
254 | | - | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
255 | 263 | | |
256 | 264 | | |
257 | 265 | | |
| |||
0 commit comments