[Mlir-commits] [mlir] [mlir][emitc] Deferred emission as expressions (PR #159975)

Gil Rapaport llvmlistbot at llvm.org
Sat Sep 27 06:57:10 PDT 2025


================
@@ -31,9 +31,9 @@ func.func @member(%arg0: !emitc.opaque<"mystruct">, %arg1: i32, %arg2: index) {
 // CPP-DEFAULT-NEXT: int32_t [[V3:[^ ]*]] = [[V2]].b;
 // CPP-DEFAULT-NEXT: int32_t [[V4:[^ ]*]];
 // CPP-DEFAULT-NEXT: [[V4]] = [[V3]];
-// CPP-DEFAULT-NEXT: int32_t [[V5:[^ ]*]] = [[V2]].c[[[Index]]];
+// CPP-DEFAULT-NEXT: int32_t [[V5:[^ ]*]] = ([[V2]].c)[[[Index]]];
 // CPP-DEFAULT-NEXT: [[V4]] = [[V5]];
-// CPP-DEFAULT-NEXT: [[V2]].d[[[Index]]] = [[V1]];
+// CPP-DEFAULT-NEXT: ([[V2]].d)[[[Index]]] = [[V1]];
----------------
aniragil wrote:

It's a side effect: When emitting expressions we currently don't omit parentheses when operator precedence is equal and associativity is left-to-right, as is the case for `.` and `[]`.

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


More information about the Mlir-commits mailing list