[all-commits] [llvm/llvm-project] 89c9f7: [mlir][emitc] Inline expressions with side-effects...
Gil Rapaport via All-commits
all-commits at lists.llvm.org
Mon Oct 13 01:01:47 PDT 2025
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 89c9f7e34c145bfa33e4235e7c205300eb1c0333
https://github.com/llvm/llvm-project/commit/89c9f7e34c145bfa33e4235e7c205300eb1c0333
Author: Gil Rapaport <gil.rapaport at mobileye.com>
Date: 2025-10-13 (Mon, 13 Oct 2025)
Changed paths:
M mlir/lib/Target/Cpp/TranslateToCpp.cpp
M mlir/test/Target/Cpp/expressions.mlir
Log Message:
-----------
[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`.
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list