Skip to content

[mlir] Inconsistent results for arith.ceildivsi #115293

@AnonymousBugreporter1

Description

@AnonymousBugreporter1

I have the following MLIR program:
test.mlir:

module {
  func.func @func1() -> f32 {
    %c1189465982_i64 = arith.constant 1189465982 : i64
    %c-9223372036854775808_i64 = arith.constant -9223372036854775808 : i64
    %156 = arith.ceildivsi %c-9223372036854775808_i64, %c1189465982_i64 : i64
    vector.print %156 : i64
    %0 = arith.sitofp %156 : i64 to f32
    return %0 : f32
  }
}

When I ran /data/tmp/v1107/llvm-project/build/bin/mlir-opt --int-range-optimizations --arith-expand --convert-arith-to-llvm --convert-vector-to-llvm --convert-func-to-llvm --reconcile-unrealized-casts test.mlir | /data/tmp/v1107/llvm-project/build/bin/mlir-cpu-runner -e func1 --shared-libs=/data/tmp/v1107/llvm-project/build/lib/libmlir_runner_utils.so,/data/tmp/v1107/llvm-project/build/lib/libmlir_c_runner_utils.so on the program, I got the result of:

-7754212542
-7.754212e+09

However, when I ran /data/tmp/v1107/llvm-project/build/bin/mlir-opt --arith-expand --convert-arith-to-llvm --convert-vector-to-llvm --convert-func-to-llvm --reconcile-unrealized-casts test.mlir | /data/tmp/v1107/llvm-project/build/bin/mlir-cpu-runner -e func1 --shared-libs=/data/tmp/v1107/llvm-project/build/lib/libmlir_runner_utils.so,/data/tmp/v1107/llvm-project/build/lib/libmlir_c_runner_utils.so on the program, I got the result of:

7754212542
7.754212e+09

The above two results seem to be inconsistent. I'm not sure if there is any bug in my program or if the wrong usage of the above passes caused these results.

My git version is 1469d82.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions