[Mlir-commits] [mlir] [mlir][Math] Fix IPowIOp folding crash for i1 (PR #179684)
Jakub Kuderski
llvmlistbot at llvm.org
Thu Feb 5 06:00:10 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
----------------
kuhar wrote:
I think the answer should be the same as with other values that make it overflow, for example: `ipowi int_max, int_max`. Right now the operation description doesn't cover this.
I checked some other implementations. And rust defines the exponent as unsigned and panics on overflow. Julia wraps on overflow. In Fortran, negative exponents result in 0.
To me it would make sense to have the base case wrap on overflow and return `true`, and allow poison under a `nsw` flag.
https://github.com/llvm/llvm-project/pull/179684
More information about the Mlir-commits
mailing list