Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MLIR]-test-liveness-analysis triggers Assertion Failure `liveness && "expected a sparse lattice"' #128337

Open
xisang0 opened this issue Feb 22, 2025 · 1 comment
Labels
crash Prefer [crash-on-valid] or [crash-on-invalid] mlir

Comments

@xisang0
Copy link

xisang0 commented Feb 22, 2025

Test on commit: abc4183
steps to reproduce:

mlir-opt test.mlir -test-liveness-analysis

test case:

func.func private @private2(%0 : i32) -> () {
  %cond = arith.index_cast %0 {tag = "in_private2"} : i32 to index
  %1 = scf.index_switch %cond -> i32
  default {
    %thirty = arith.constant 30 : i32
    scf.yield %thirty : i32
  }
  func.return
}

crash trace:

test_tag: in_private2:
mlir-opt: /home/workdir/llvm-project-19/mlir/test/lib/Analysis/DataFlow/TestLivenessAnalysis.cpp:48: auto (anonymous namespace)::TestLivenessAnalysisPass::runOnOperation()::(anonymous class)::operator()(Operation *) const: Assertion `liveness && "expected a sparse lattice"' failed.
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0.      Program arguments: ./mlir-opt /home/workdir/test.mlir -test-liveness-analysis
 #0 0x00005757f38b62b8 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (./mlir-opt+0x10b62b8)
 #1 0x00005757f38b3dde llvm::sys::RunSignalHandlers() (./mlir-opt+0x10b3dde)
 #2 0x00005757f38b6cc8 SignalHandler(int) Signals.cpp:0:0
 #3 0x000075ae43ec9520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
 #4 0x000075ae43f1d9fc pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x969fc)
 #5 0x000075ae43ec9476 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x42476)
 #6 0x000075ae43eaf7f3 abort (/lib/x86_64-linux-gnu/libc.so.6+0x287f3)
 #7 0x000075ae43eaf71b (/lib/x86_64-linux-gnu/libc.so.6+0x2871b)
 #8 0x000075ae43ec0e96 (/lib/x86_64-linux-gnu/libc.so.6+0x39e96)
 #9 0x00005757f675ef79 void llvm::function_ref<void (mlir::Operation*)>::callback_fn<(anonymous namespace)::TestLivenessAnalysisPass::runOnOperation()::'lambda'(mlir::Operation*)>(long, mlir::Operation*) TestLivenessAnalysis.cpp:0:0
#10 0x00005757f39ca0ae void mlir::detail::walk<mlir::ForwardIterator>(mlir::Operation*, llvm::function_ref<void (mlir::Operation*)>, mlir::WalkOrder) (./mlir-opt+0x11ca0ae)
#11 0x00005757f39ca0ae void mlir::detail::walk<mlir::ForwardIterator>(mlir::Operation*, llvm::function_ref<void (mlir::Operation*)>, mlir::WalkOrder) (./mlir-opt+0x11ca0ae)
#12 0x00005757f675e5f8 (anonymous namespace)::TestLivenessAnalysisPass::runOnOperation() TestLivenessAnalysis.cpp:0:0
#13 0x00005757f6cac64f mlir::detail::OpToOpPassAdaptor::run(mlir::Pass*, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int) (./mlir-opt+0x44ac64f)
#14 0x00005757f6cacdd2 mlir::detail::OpToOpPassAdaptor::runPipeline(mlir::OpPassManager&, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int, mlir::PassInstrumentor*, mlir::PassInstrumentation::PipelineParentInfo const*) (./mlir-opt+0x44acdd2)
#15 0x00005757f6caf55e mlir::PassManager::run(mlir::Operation*) (./mlir-opt+0x44af55e)
#16 0x00005757f6ca80ab performActions(llvm::raw_ostream&, std::shared_ptr<llvm::SourceMgr> const&, mlir::MLIRContext*, mlir::MlirOptMainConfig const&) MlirOptMain.cpp:0:0
#17 0x00005757f6ca7d03 llvm::LogicalResult llvm::function_ref<llvm::LogicalResult (std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, 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::raw_ostream&) MlirOptMain.cpp:0:0
#18 0x00005757f6d51465 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::raw_ostream&)>, llvm::raw_ostream&, llvm::StringRef, llvm::StringRef) (./mlir-opt+0x4551465)
#19 0x00005757f6ca1962 mlir::MlirOptMain(llvm::raw_ostream&, std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, mlir::DialectRegistry&, mlir::MlirOptMainConfig const&) (./mlir-opt+0x44a1962)
#20 0x00005757f6ca1c13 mlir::MlirOptMain(int, char**, llvm::StringRef, llvm::StringRef, mlir::DialectRegistry&) (./mlir-opt+0x44a1c13)
#21 0x00005757f6ca1e22 mlir::MlirOptMain(int, char**, llvm::StringRef, mlir::DialectRegistry&) (./mlir-opt+0x44a1e22)
#22 0x00005757f38954d7 main (./mlir-opt+0x10954d7)
#23 0x000075ae43eb0d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#24 0x000075ae43eb0e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#25 0x00005757f3895045 _start (./mlir-opt+0x1095045)
Aborted (core dumped)
@llvmbot llvmbot added the mlir label Feb 22, 2025
@llvmbot
Copy link
Member

llvmbot commented Feb 22, 2025

@llvm/issue-subscribers-mlir

Author: None (xisang0)

Test on commit: https://github.com/llvm/llvm-project/commit/abc4183c731e0a352ebebc96106e3622e6ad5029 steps to reproduce: ``` mlir-opt test.mlir -test-liveness-analysis ``` test case: ``` func.func private @private2(%0 : i32) -> () { %cond = arith.index_cast %0 {tag = "in_private2"} : i32 to index %1 = scf.index_switch %cond -> i32 default { %thirty = arith.constant 30 : i32 scf.yield %thirty : i32 } func.return } ``` crash trace: ``` test_tag: in_private2: mlir-opt: /home/workdir/llvm-project-19/mlir/test/lib/Analysis/DataFlow/TestLivenessAnalysis.cpp:48: auto (anonymous namespace)::TestLivenessAnalysisPass::runOnOperation()::(anonymous class)::operator()(Operation *) const: Assertion `liveness && "expected a sparse lattice"' failed. PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace. Stack dump: 0. Program arguments: ./mlir-opt /home/workdir/test.mlir -test-liveness-analysis #0 0x00005757f38b62b8 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (./mlir-opt+0x10b62b8) #1 0x00005757f38b3dde llvm::sys::RunSignalHandlers() (./mlir-opt+0x10b3dde) #2 0x00005757f38b6cc8 SignalHandler(int) Signals.cpp:0:0 #3 0x000075ae43ec9520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520) #4 0x000075ae43f1d9fc pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x969fc) #5 0x000075ae43ec9476 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x42476) #6 0x000075ae43eaf7f3 abort (/lib/x86_64-linux-gnu/libc.so.6+0x287f3) #7 0x000075ae43eaf71b (/lib/x86_64-linux-gnu/libc.so.6+0x2871b) #8 0x000075ae43ec0e96 (/lib/x86_64-linux-gnu/libc.so.6+0x39e96) #9 0x00005757f675ef79 void llvm::function_ref<void (mlir::Operation*)>::callback_fn<(anonymous namespace)::TestLivenessAnalysisPass::runOnOperation()::'lambda'(mlir::Operation*)>(long, mlir::Operation*) TestLivenessAnalysis.cpp:0:0 #10 0x00005757f39ca0ae void mlir::detail::walk<mlir::ForwardIterator>(mlir::Operation*, llvm::function_ref<void (mlir::Operation*)>, mlir::WalkOrder) (./mlir-opt+0x11ca0ae) #11 0x00005757f39ca0ae void mlir::detail::walk<mlir::ForwardIterator>(mlir::Operation*, llvm::function_ref<void (mlir::Operation*)>, mlir::WalkOrder) (./mlir-opt+0x11ca0ae) #12 0x00005757f675e5f8 (anonymous namespace)::TestLivenessAnalysisPass::runOnOperation() TestLivenessAnalysis.cpp:0:0 #13 0x00005757f6cac64f mlir::detail::OpToOpPassAdaptor::run(mlir::Pass*, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int) (./mlir-opt+0x44ac64f) #14 0x00005757f6cacdd2 mlir::detail::OpToOpPassAdaptor::runPipeline(mlir::OpPassManager&, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int, mlir::PassInstrumentor*, mlir::PassInstrumentation::PipelineParentInfo const*) (./mlir-opt+0x44acdd2) #15 0x00005757f6caf55e mlir::PassManager::run(mlir::Operation*) (./mlir-opt+0x44af55e) #16 0x00005757f6ca80ab performActions(llvm::raw_ostream&, std::shared_ptr<llvm::SourceMgr> const&, mlir::MLIRContext*, mlir::MlirOptMainConfig const&) MlirOptMain.cpp:0:0 #17 0x00005757f6ca7d03 llvm::LogicalResult llvm::function_ref<llvm::LogicalResult (std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, 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::raw_ostream&) MlirOptMain.cpp:0:0 #18 0x00005757f6d51465 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::raw_ostream&)>, llvm::raw_ostream&, llvm::StringRef, llvm::StringRef) (./mlir-opt+0x4551465) #19 0x00005757f6ca1962 mlir::MlirOptMain(llvm::raw_ostream&, std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, mlir::DialectRegistry&, mlir::MlirOptMainConfig const&) (./mlir-opt+0x44a1962) #20 0x00005757f6ca1c13 mlir::MlirOptMain(int, char**, llvm::StringRef, llvm::StringRef, mlir::DialectRegistry&) (./mlir-opt+0x44a1c13) #21 0x00005757f6ca1e22 mlir::MlirOptMain(int, char**, llvm::StringRef, mlir::DialectRegistry&) (./mlir-opt+0x44a1e22) #22 0x00005757f38954d7 main (./mlir-opt+0x10954d7) #23 0x000075ae43eb0d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90) #24 0x000075ae43eb0e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40) #25 0x00005757f3895045 _start (./mlir-opt+0x1095045) Aborted (core dumped) ```

@EugeneZelenko EugeneZelenko added the crash Prefer [crash-on-valid] or [crash-on-invalid] label Feb 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
crash Prefer [crash-on-valid] or [crash-on-invalid] mlir
Projects
None yet
Development

No branches or pull requests

3 participants