[Mlir-commits] [mlir] [mlir][emitc] Inline constant when translate (PR #143485)

Simon Camphausen llvmlistbot at llvm.org
Mon Jun 16 04:10:12 PDT 2025


simon-camp wrote:

> IINM `emitc.constant` is emitted as an "SSA" C variable rather than an lvalue variable, so it doesn't have side effects in the MLIR sense. BTW, might also be good to have more `emitc` ops (notably operators) have the `pure` trait for better CSE/DCE behavior.

I'm open to further discussions, but if it's pure then hoisting on the MLIR side is not wrong.

I've thought about side effects in the past and I don't know if we want to simply mark the ops as pure as you might target overloaded C++ classes that do whatever. But especially on the call_opaque op I want to be able to mark an instance as pure with an attribute for example and then override getMemoryEffects accordingly.

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


More information about the Mlir-commits mailing list