[Mlir-commits] [mlir] [mlir][emitc] Only mark operator with fundamental type have no side effect (PR #144990)

Jianjian Guan llvmlistbot at llvm.org
Mon Aug 18 19:56:45 PDT 2025


================
@@ -43,7 +43,11 @@ class EmitC_UnaryOp<string mnemonic, list<Trait> traits = []> :
 
   let extraClassDeclaration = [{
     bool hasSideEffects() {
-      return false;
+      // If operand is fundamental type, the operation is pure.
+      if (isFundamentalType(getOperand().getType())) {
+        return false;
+      }
+      return true;
----------------
jacquesguan wrote:

Addressed.

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


More information about the Mlir-commits mailing list