Issue 203858
Summary [mlir] Assertion `apInt && "expected constant loop bound"' failed.
Labels mlir
Assignees
Reporter Anonymous7i0em3yd
    git version: 58031e519153fdbe637f9f135ac1fbfef6f0e224

system: `Ubuntu 18.04.6 LTS`

reproduce with: `mlir-opt -test-loop-unrolling a.mlir`

a.mlir: 

```mlir
module {
  func.func @test_vectorize_unsupported(%arg0: memref<1x2xf16>) {
    %0 = "emitc.constant"() <{value = 2 : index}> : () -> !emitc.size_t
    %1 = builtin.unrealized_conversion_cast %0 : !emitc.size_t to index
    %2 = "emitc.constant"() <{value = 0.000000e+00 : f16}> : () -> f16
    scf.for %arg1 = %1 to %1 step %1 {
      %3 = memref.load %arg0[%arg1, %1] : memref<1x2xf16>
      %4 = emitc.add %3, %2 : (f16, f16) -> f16
      memref.store %4, %arg0[%arg1, %1] : memref<1x2xf16>
    }
    return
  }
}

```

stack trace:

```
mlir-opt: /data/szy/MLIR/llvm-release/llvm-project/mlir/lib/Dialect/SCF/Utils/Utils.cpp:403: auto mlir::loopUnrollByFactor(scf::ForOp, uint64_t, function_ref<void (unsigned int, Operation *, OpBuilder)>)::(anonymous class)::operator()(Value) const: Assertion `apInt && "expected constant loop bound"' failed.
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: /data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt -test-loop-unrolling 13.mlir
 #0 0x00005615f840d798 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x1ff4798)
 #1 0x00005615f840a631 llvm::sys::RunSignalHandlers() (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x1ff1631)
 #2 0x00005615f840e8b6 SignalHandler(int, siginfo_t*, void*) Signals.cpp:0:0
 #3 0x00007f0b06723420 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x14420)
 #4 0x00007f0b05d6000b raise /build/glibc-LcI20x/glibc-2.31/signal/../sysdeps/unix/sysv/linux/raise.c:51:1
 #5 0x00007f0b05d3f859 abort /build/glibc-LcI20x/glibc-2.31/stdlib/abort.c:81:7
 #6 0x00007f0b05d3f729 get_sysdep_segment_value /build/glibc-LcI20x/glibc-2.31/intl/loadmsgcat.c:509:8
 #7 0x00007f0b05d3f729 _nl_load_domain /build/glibc-LcI20x/glibc-2.31/intl/loadmsgcat.c:970:34
 #8 0x00007f0b05d50fd6 (/lib/x86_64-linux-gnu/libc.so.6+0x33fd6)
 #9 0x00005615ff33854a mlir::loopUnrollByFactor(mlir::scf::ForOp, unsigned long, llvm::function_ref<void (unsigned int, mlir::Operation*, mlir::OpBuilder)>)::$_0::operator()(mlir::Value) const Utils.cpp:0:0
#10 0x00005615ff33779c mlir::loopUnrollByFactor(mlir::scf::ForOp, unsigned long, llvm::function_ref<void (unsigned int, mlir::Operation*, mlir::OpBuilder)>) (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x8f1e79c)
#11 0x00005615f8508a22 (anonymous namespace)::TestLoopUnrollingPass::runOnOperation() TestLoopUnrolling.cpp:0:0
#12 0x0000561600dc9c22 mlir::detail::OpToOpPassAdaptor::run(mlir::Pass*, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int) (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0xa9b0c22)
#13 0x0000561600dcaa64 mlir::detail::OpToOpPassAdaptor::runPipeline(mlir::OpPassManager&, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int, mlir::PassInstrumentor*, mlir::PassInstrumentation::PipelineParentInfo const*) (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0xa9b1a64)
#14 0x0000561600dd197a mlir::PassManager::runPasses(mlir::Operation*, mlir::AnalysisManager) (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0xa9b897a)
#15 0x0000561600dd12af mlir::PassManager::run(mlir::Operation*) (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0xa9b82af)
#16 0x00005615f84be940 performActions(llvm::raw_ostream&, std::shared_ptr<llvm::SourceMgr> const&, mlir::MLIRContext*, mlir::MlirOptMainConfig const&) MlirOptMain.cpp:0:0
#17 0x00005615f84bdb76 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&)::$_0>(long, std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, llvm::MemoryBufferRef const&, llvm::raw_ostream&) MlirOptMain.cpp:0:0
#18 0x000056160111eca5 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) (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0xad05ca5)
#19 0x00005615f84b3776 mlir::MlirOptMain(llvm::raw_ostream&, std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, mlir::DialectRegistry&, mlir::MlirOptMainConfig const&) (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x209a776)
#20 0x00005615f84b3b55 mlir::MlirOptMain(int, char**, llvm::StringRef, llvm::StringRef, mlir::DialectRegistry&) (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x209ab55)
#21 0x00005615f84b3eb5 mlir::MlirOptMain(int, char**, llvm::StringRef, mlir::DialectRegistry&) (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x209aeb5)
#22 0x00005615f83f3222 main (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x1fda222)
#23 0x00007f0b05d41083 __libc_start_main /build/glibc-LcI20x/glibc-2.31/csu/../csu/libc-start.c:342:3
#24 0x00005615f83f2d5e _start (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x1fd9d5e)
Aborted (core dumped)
```

_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to