[Mlir-commits] [mlir] [mlir][EmitC] Emit parentheses when expression ops are used as operands (PR #93691)

Simon Camphausen llvmlistbot at llvm.org
Mon Jun 3 04:58:02 PDT 2024


simon-camp wrote:

> I wonder if we could instead add another restriction to `shouldBeInlined`: Don't inline if the user has the `CExpression` trait. The rationale is that the using `CExpression` could have been fused into its operand `ExpressionOp`. If it wasn't, then the pass(es) that formed the expressions did not want it to be fused. Inlining the `ExpressionOp` operand into it goes against that intention. This would also make sure that we handle expression emission in one place, i.e. `ExpressionOp`s, where `cast` should already be emitted correctly with parenthesis as needed.

I implemented this in the last commit. I don't know which of these solutions is preferable.

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


More information about the Mlir-commits mailing list