diff options
author | Gil Rapaport <gil.rapaport@mobileye.com> | 2025-10-13 11:01:25 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-10-13 11:01:25 +0300 |
commit | 89c9f7e34c145bfa33e4235e7c205300eb1c0333 (patch) | |
tree | 2702c6de0bda17fc613b389ae7391a19bf088656 /llvm/lib/CodeGen/AssignmentTrackingAnalysis.cpp | |
parent | 1389980ed746910c31196a46ff4ebb67b81f2263 (diff) | |
download | llvm-89c9f7e34c145bfa33e4235e7c205300eb1c0333.zip llvm-89c9f7e34c145bfa33e4235e7c205300eb1c0333.tar.gz llvm-89c9f7e34c145bfa33e4235e7c205300eb1c0333.tar.bz2 |
[mlir][emitc] Inline expressions with side-effects (#161356)
So far the translator only inlined expressions having no side effects,
as rescheduling their evaluation doesn't break semantics. This patch
adds inlining of expressions containing side effects if defined just
before their use, e.g.,
```mlir
%c = emitc.expression %a, %b : (i32, !emitc.ptr<i32>) -> i32 {
%e = emitc.sub %a, %b : (!emitc.ptr<i32>, i32) -> !emitc.ptr<i32>
%d = emitc.apply "*"(%e) : (!emitc.ptr<i32>) -> i32
emitc.yield %d : i32
}
emitc.return %c : i32
```
This restriction is meant to keep the translator as simple as possible,
leaving it to transformations to analyze and reorder ops as needed in
more complicated cases.
The patch handles inlining into `emitc.return`, `emitc.if`,
`emitc.switch` and (to some extent) `emitc.assign`.
Diffstat (limited to 'llvm/lib/CodeGen/AssignmentTrackingAnalysis.cpp')
0 files changed, 0 insertions, 0 deletions