[Mlir-commits] [mlir] [mlir][emitc] Only mark operator with fundamental type have no side effect (PR #144990)
Gil Rapaport
llvmlistbot at llvm.org
Thu Aug 14 03:24:59 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;
----------------
aniragil wrote:
```suggestion
// If operand is fundamental type, the operation is pure.
return !isFundamentalType(getOperand().getType());
```
https://github.com/llvm/llvm-project/pull/144990
More information about the Mlir-commits
mailing list