[Mlir-commits] [mlir] [mlir][Math] Fix IPowIOp folding crash for i1 (PR #179684)
Matthias Springer
llvmlistbot at llvm.org
Thu Feb 5 04:08:07 PST 2026
================
@@ -564,3 +564,45 @@ func.func @isnormal_fold_vec() -> (vector<4xi1>) {
%0 = math.isnormal %v1 : vector<4xf32>
return %0 : vector<4xi1>
}
+
+// CHECK-LABEL: func.func @ipowi_i1_0_pow_0
+// CHECK: %[[T0:.+]] = arith.constant true
----------------
matthias-springer wrote:
I think this is technically not correct.
```
0 ^ 0 = 1
```
`math.ipowi` has signed semantics: base, exponent and result are all interpreted as signed. However, signed `i1` cannot represent `1`. The only values are `0` and `-1`.
This makes me wonder: Should we fold this to `ub.poison`? Or not fold at all? @kuhar What would you do here?
https://github.com/llvm/llvm-project/pull/179684
More information about the Mlir-commits
mailing list