[Mlir-commits] [mlir] [mlir][emitc] Add increment and decrement ops (PR #208648)

Gil Rapaport llvmlistbot at llvm.org
Fri Jul 17 08:07:50 PDT 2026


================
@@ -148,6 +148,15 @@ func.func @unary(%arg0: i32) {
   return
 }
 
+func.func @inc_dec(%arg0: !emitc.ptr<i32>) {
+  %v = "emitc.variable"() <{value = 0 : i32}> : () -> !emitc.lvalue<i32>
+  %0 = emitc.pre_increment %v : !emitc.lvalue<i32>
+  %1 = emitc.post_increment %v : !emitc.lvalue<i32>
+  %2 = emitc.pre_decrement %v : !emitc.lvalue<i32>
+  %3 = emitc.post_decrement %v : !emitc.lvalue<i32>
----------------
aniragil wrote:

IINM the pre-operators in C++ return an lvalue. I'm note sure if/how that's a problem ATM, but it may be worth documenting in the op's tablegen comment.

https://github.com/llvm/llvm-project/pull/208648


More information about the Mlir-commits mailing list