| Issue |
239604
|
| Summary |
[MLIR]Crash in integer divisibility analysis on arith.divui with zero divisor
|
| Labels |
mlir
|
| Assignees |
|
| Reporter |
frida-albrecht
|
The `--test-int-divisibility-analysis` pass crashes with a floating-point exception when analyzing an `arith.divui` operation with a constant zero divisor.
test commit: [4fb8315](https://github.com/llvm/llvm-project/commit/4fb83151289b8c9f5255d7e899d11ea94374c394)
test case:
```mlir
module {
func.func @main(%arg0: tensor<4x4xi8>, %arg1: tensor<3xi1>, %arg2: f64) -> tensor<4x4xindex> {
%c0 = arith.constant 0 : index
%c1 = arith.constant 1 : index
%c10 = arith.constant 10 : index
%0:2 = scf.for %arg3 = %c0 to %c10 step %c1 iter_args(%arg4 = %arg0, %arg5 = %arg2) -> (tensor<4x4xi8>, f64) {
%3 = arith.addi %arg4, %arg4 : tensor<4x4xi8>
%4 = arith.addf %arg5, %arg5 : f64
scf.yield %3, %4 : tensor<4x4xi8>, f64
}
%1 = arith.index_castui %0#0 : tensor<4x4xi8> to tensor<4x4xindex>
%2 = arith.divui %c10, %c0 exact : index
return %1 : tensor<4x4xindex>
}
}
```
Step to reproduce:
```
mlir-opt test.mlir --test-int-divisibility-analysis
```
Crash backtrace:
```
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace and instructions to reproduce the bug.
Stack dump:
0. Program arguments: mlir-opt test.mlir --test-int-divisibility-analysis
#0 0x000055dd3faec139 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/home/llvm-project/llvm-project-latest/build/bin/mlir-opt+0x1fdb139)
#1 0x000055dd3fae893c llvm::sys::RunSignalHandlers() (/home/llvm-project/llvm-project-latest/build/bin/mlir-opt+0x1fd793c)
#2 0x000055dd3fae8aa6 SignalHandler(int, siginfo_t*, void*) Signals.cpp:0:0
#3 0x00007f6a48b06520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
#4 0x000055dd4812dd83 mlir::arith::DivUIOp::inferResultDivisibility(llvm::ArrayRef<mlir::IntegerDivisibility>, llvm::function_ref<void (mlir::Value, mlir::ConstantIntDivisibility const&)>) (/home/llvm-project/llvm-project-latest/build/bin/mlir-opt+0xa61cd83)
#5 0x000055dd480fccf9 mlir::detail::InferIntDivisibilityOpInterfaceInterfaceTraits::Model<mlir::arith::DivUIOp>::inferResultDivisibility(mlir::detail::InferIntDivisibilityOpInterfaceInterfaceTraits::Concept const*, mlir::Operation*, llvm::ArrayRef<mlir::IntegerDivisibility>, llvm::function_ref<void (mlir::Value, mlir::ConstantIntDivisibility const&)>) (/home/llvm-project/llvm-project-latest/build/bin/mlir-opt+0xa5ebcf9)
#6 0x000055dd481c1140 mlir::dataflow::IntegerDivisibilityAnalysis::visitOperation(mlir::Operation*, llvm::ArrayRef<mlir::dataflow::IntegerDivisibilityLattice const*>, llvm::ArrayRef<mlir::dataflow::IntegerDivisibilityLattice*>) (/home/llvm-project/llvm-project-latest/build/bin/mlir-opt+0xa6b0140)
#7 0x000055dd481d5387 mlir::dataflow::AbstractSparseForwardDataFlowAnalysis::visitOperation(mlir::Operation*) (.part.0) SparseAnalysis.cpp:0:0
#8 0x000055dd481d5f3b mlir::dataflow::AbstractSparseForwardDataFlowAnalysis::visitOperation(mlir::Operation*) (/home/llvm-project/llvm-project-latest/build/bin/mlir-opt+0xa6c4f3b)
#9 0x000055dd481d6b9e mlir::dataflow::AbstractSparseForwardDataFlowAnalysis::initializeRecursively(mlir::Operation*) (/home/llvm-project/llvm-project-latest/build/bin/mlir-opt+0xa6c5b9e)
#10 0x000055dd481d717c mlir::dataflow::AbstractSparseForwardDataFlowAnalysis::initializeRecursively(mlir::Operation*) (/home/llvm-project/llvm-project-latest/build/bin/mlir-opt+0xa6c617c)
#11 0x000055dd481d717c mlir::dataflow::AbstractSparseForwardDataFlowAnalysis::initializeRecursively(mlir::Operation*) (/home/llvm-project/llvm-project-latest/build/bin/mlir-opt+0xa6c617c)
#12 0x000055dd481a7b6f mlir::DataFlowSolver::initializeAndRun(mlir::Operation*, llvm::function_ref<bool (mlir::DataFlowAnalysis&)>) (/home/llvm-project/llvm-project-latest/build/bin/mlir-opt+0xa696b6f)
#13 0x000055dd3fc9e859 (anonymous namespace)::TestIntegerDivisibilityAnalysisPass::runOnOperation() TestIntegerDivisibilityAnalysis.cpp:0:0
#14 0x000055dd482f53b9 mlir::detail::OpToOpPassAdaptor::run(mlir::Pass*, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int) (/home/llvm-project/llvm-project-latest/build/bin/mlir-opt+0xa7e43b9)
#15 0x000055dd482f5694 mlir::detail::OpToOpPassAdaptor::runPipeline(mlir::OpPassManager&, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int, mlir::PassInstrumentor*, mlir::PassInstrumentation::PipelineParentInfo const*) (/home/llvm-project/llvm-project-latest/build/bin/mlir-opt+0xa7e4694)
#16 0x000055dd482f72e2 mlir::PassManager::runPasses(mlir::Operation*, mlir::AnalysisManager) (/home/llvm-project/llvm-project-latest/build/bin/mlir-opt+0xa7e62e2)
#17 0x000055dd482f82b9 mlir::PassManager::run(mlir::Operation*) (/home/llvm-project/llvm-project-latest/build/bin/mlir-opt+0xa7e72b9)
#18 0x000055dd3fbb6696 performActions(llvm::raw_ostream&, std::shared_ptr<llvm::SourceMgr> const&, mlir::MLIRContext*, mlir::MlirOptMainConfig const&) MlirOptMain.cpp:0:0
#19 0x000055dd3fbb7c4e processBuffer(llvm::raw_ostream&, std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, llvm::MemoryBufferRef, mlir::MlirOptMainConfig const&, mlir::DialectRegistry&, mlir::SourceMgrDiagnosticVerifierHandler*, llvm::ThreadPoolInterface*) MlirOptMain.cpp:0:0
#20 0x000055dd3fbb7e91 llvm::LogicalResult llvm::function_ref<llvm::LogicalResult (std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, llvm::MemoryBufferRef const&, llvm::raw_ostream&)>::callback_fn<mlir::MlirOptMain(llvm::raw_ostream&, std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, mlir::DialectRegistry&, mlir::MlirOptMainConfig const&)::'lambda'(std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, llvm::MemoryBufferRef, llvm::raw_ostream&)>(long, std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, llvm::MemoryBufferRef const&, llvm::raw_ostream&) MlirOptMain.cpp:0:0
#21 0x000055dd4866b4cd mlir::splitAndProcessBuffer(std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, llvm::function_ref<llvm::LogicalResult (std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, llvm::MemoryBufferRef const&, llvm::raw_ostream&)>, llvm::raw_ostream&, llvm::StringRef, llvm::StringRef) (/home/llvm-project/llvm-project-latest/build/bin/mlir-opt+0xab5a4cd)
#22 0x000055dd3fbb1b8a mlir::MlirOptMain(llvm::raw_ostream&, std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, mlir::DialectRegistry&, mlir::MlirOptMainConfig const&) (.part.0) MlirOptMain.cpp:0:0
#23 0x000055dd3fbb84d1 mlir::MlirOptMain(int, char**, llvm::StringRef, llvm::StringRef, mlir::DialectRegistry&) (/home/llvm-project/llvm-project-latest/build/bin/mlir-opt+0x20a74d1)
#24 0x000055dd3fbb8724 mlir::MlirOptMain(int, char**, llvm::StringRef, mlir::DialectRegistry&) (/home/llvm-project/llvm-project-latest/build/bin/mlir-opt+0x20a7724)
#25 0x000055dd3fa8dd5c main (/home/llvm-project/llvm-project-latest/build/bin/mlir-opt+0x1f7cd5c)
#26 0x00007f6a48aedd90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#27 0x00007f6a48aede40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#28 0x000055dd3facb9d5 _start (/home/llvm-project/llvm-project-latest/build/bin/mlir-opt+0x1fba9d5)
Floating point exception (core dumped)
```
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs