llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
28.42k stars 11.74k forks source link

[flang] HLFIR forall tests trigger assertion failures on macOS #70805

Closed luporl closed 7 months ago

luporl commented 11 months ago

Both HLFIR/forall-index.fir and Lower/HLFIR/forall.f90 tests cause bbc to abort execution after an assertion failure: Assertion failed: (op->use_empty() && "expected 'op' to have no uses"), function eraseOp, file PatternMatch.cpp, line 307.

Below is the output of Lower/HLFIR/forall.f90 failure:

FAIL: Flang :: Lower/HLFIR/forall.f90 (1 of 1)
******************** TEST 'Flang :: Lower/HLFIR/forall.f90' FAILED ********************
Exit Code: 2

Command Output (stderr):
--
RUN: at line 2: bbc --hlfir -o - /Users/leandro.lupori/git/flang-luporl/llvm-project/flang/test/Lower/HLFIR/forall.f90 | /Users/leandro.lupori/git/flang-luporl/buildr/bin/FileCheck /Users/leandro.lupori/git/flang-luporl/llvm-project/flang/test/Lower/HLFIR/forall.f90
+ bbc --hlfir -o - /Users/leandro.lupori/git/flang-luporl/llvm-project/flang/test/Lower/HLFIR/forall.f90
+ /Users/leandro.lupori/git/flang-luporl/buildr/bin/FileCheck /Users/leandro.lupori/git/flang-luporl/llvm-project/flang/test/Lower/HLFIR/forall.f90
Assertion failed: (op->use_empty() && "expected 'op' to have no uses"), function eraseOp, file PatternMatch.cpp, line 307.
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0.  Program arguments: bbc --hlfir -o - /Users/leandro.lupori/git/flang-luporl/llvm-project/flang/test/Lower/HLFIR/forall.f90
 #0 0x0000000102cbba54 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/Users/leandro.lupori/git/flang-luporl/buildr/bin/bbc+0x101f9fa54)
 #1 0x0000000102cb9bf8 llvm::sys::RunSignalHandlers() (/Users/leandro.lupori/git/flang-luporl/buildr/bin/bbc+0x101f9dbf8)
 #2 0x0000000102cbc104 SignalHandler(int) (/Users/leandro.lupori/git/flang-luporl/buildr/bin/bbc+0x101fa0104)
 #3 0x0000000184439a24 (/usr/lib/system/libsystem_platform.dylib+0x180465a24)
 #4 0x000000018440acc0 (/usr/lib/system/libsystem_pthread.dylib+0x180436cc0)
 #5 0x000000018431aa50 (/usr/lib/system/libsystem_c.dylib+0x180346a50)
 #6 0x0000000184319d6c (/usr/lib/system/libsystem_c.dylib+0x180345d6c)
 #7 0x0000000102f43a6c mlir::RewriterBase::eraseBlock(mlir::Block*) (.cold.1) (/Users/leandro.lupori/git/flang-luporl/buildr/bin/bbc+0x102227a6c)
 #8 0x0000000102ba82c4 mlir::RewriterBase::eraseOp(mlir::Operation*) (/Users/leandro.lupori/git/flang-luporl/buildr/bin/bbc+0x101e8c2c4)
 #9 0x0000000100fa3fb8 hlfir::ForallIndexOp::canonicalize(hlfir::ForallIndexOp, mlir::PatternRewriter&) (/Users/leandro.lupori/git/flang-luporl/buildr/bin/bbc+0x100287fb8)
#10 0x0000000102a60970 void llvm::function_ref<void ()>::callback_fn<mlir::PatternApplicator::matchAndRewrite(mlir::Operation*, mlir::PatternRewriter&, llvm::function_ref<bool (mlir::Pattern const&)>, llvm::function_ref<void (mlir::Pattern const&)>, llvm::function_ref<mlir::LogicalResult (mlir::Pattern const&)>)::$_2>(long) (/Users/leandro.lupori/git/flang-luporl/buildr/bin/bbc+0x101d44970)
#11 0x0000000102a5dccc mlir::PatternApplicator::matchAndRewrite(mlir::Operation*, mlir::PatternRewriter&, llvm::function_ref<bool (mlir::Pattern const&)>, llvm::function_ref<void (mlir::Pattern const&)>, llvm::function_ref<mlir::LogicalResult (mlir::Pattern const&)>) (/Users/leandro.lupori/git/flang-luporl/buildr/bin/bbc+0x101d41ccc)
#12 0x0000000102a2da38 (anonymous namespace)::GreedyPatternRewriteDriver::processWorklist() (/Users/leandro.lupori/git/flang-luporl/buildr/bin/bbc+0x101d11a38)
#13 0x0000000102a2aa68 mlir::applyPatternsAndFoldGreedily(mlir::Region&, mlir::FrozenRewritePatternSet const&, mlir::GreedyRewriteConfig, bool*) (/Users/leandro.lupori/git/flang-luporl/buildr/bin/bbc+0x101d0ea68)
#14 0x00000001029fad14 (anonymous namespace)::Canonicalizer::runOnOperation() (/Users/leandro.lupori/git/flang-luporl/buildr/bin/bbc+0x101cded14)
#15 0x0000000102a872c8 mlir::detail::OpToOpPassAdaptor::run(mlir::Pass*, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int) (/Users/leandro.lupori/git/flang-luporl/buildr/bin/bbc+0x101d6b2c8)
#16 0x0000000102a87928 mlir::detail::OpToOpPassAdaptor::runPipeline(mlir::OpPassManager&, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int, mlir::PassInstrumentor*, mlir::PassInstrumentation::PipelineParentInfo const*) (/Users/leandro.lupori/git/flang-luporl/buildr/bin/bbc+0x101d6b928)
#17 0x0000000102a89958 mlir::PassManager::run(mlir::Operation*) (/Users/leandro.lupori/git/flang-luporl/buildr/bin/bbc+0x101d6d958)
#18 0x0000000100d229dc main (/Users/leandro.lupori/git/flang-luporl/buildr/bin/bbc+0x1000069dc)
#19 0x0000000184091058
FileCheck error: '<stdin>' is empty.
FileCheck command line:  /Users/leandro.lupori/git/flang-luporl/buildr/bin/FileCheck /Users/leandro.lupori/git/flang-luporl/llvm-project/flang/test/Lower/HLFIR/forall.f90

--

********************
********************
Failed Tests (1):
  Flang :: Lower/HLFIR/forall.f90
luporl commented 7 months ago

Recently HLFIR forall tests stopped failing on my machine. Some recent commit must have fixed them.