-
Notifications
You must be signed in to change notification settings - Fork 15.1k
Closed
Labels
Description
I have the following MLIR program:
test.mlir:
module {
func.func @func1() {
%c8_i32 = arith.constant 8 : i32
%c29326_i32 = arith.constant 29326 : i32
%c2_i32 = arith.constant 2 : i32
%c1_i32 = arith.constant 1 : i32
%30 = arith.shrsi %c29326_i32, %c2_i32 : i32 // the result should be 7331, which is 1110010100011 of binary
%47 = math.ctpop %30 : i32 // the result should be 7
%57 = arith.shli %47, %c1_i32 : i32 // the result should be 14
%65 = arith.ceildivsi %57, %c8_i32 : i32 // the result should be 2
vector.print %65 : i32
return
}
}
However, when I ran mlir-opt --arith-expand --arith-unsigned-when-equivalent --int-range-optimizations test.mlir
on the program, I got the following result:
module {
func.func @func1() {
%c-536870910_i32 = arith.constant -536870910 : i32
vector.print %c-536870910_i32 : i32
return
}
}
And when I ran mlir-opt --arith-expand --int-range-optimizations test.mlir
on the program, I got the following result:
module {
func.func @func1() {
%c1_i32 = arith.constant 1 : i32
vector.print %c1_i32 : i32
return
}
}
I've tried to analyze my program manually, and my result is that the value of the constant operation seems to be 2, which is different from either of the above results. I'm not sure if there is any bug in my program or some other problems that caused these results.
My git version is 1a8c613.