<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/116370>116370</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[MLIR]`-test-ir-visitors` triggers Assertion Failure `mayHaveSSADominance(region) && "graph regions are not allowed"'
</td>
</tr>
<tr>
<th>Labels</th>
<td>
mlir
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
xisang0
</td>
</tr>
</table>
<pre>
Test on commit: https://github.com/llvm/llvm-project/commit/47928ab16b675c17826ada16f23aa0569e93a474
steps to reproduce:
```
mlir-opt test.mlir -test-ir-visitors
```
test case:
```
module{
func.func @fuse_repeated(%fill: tensor<2xf32>, %output: tensor<2xf32>) {
%c0 = arith.constant 0.0 : f32
%0 = linalg.fill ins(%c0 : f32) outs(%fill : tensor<2xf32>) -> tensor<2xf32>
%1 = scf.forall (%i) in (2) shared_outs(%arg1 = %output) -> (tensor<2xf32>) {
%2 = tensor.extract_slice %0[%i][1][1] : tensor<2xf32> to tensor<1xf32>
%3 = tensor.extract_slice %arg1[%i][1][1] : tensor<2xf32> to tensor<1xf32>
%4 = linalg.elemwise_unary ins(%2 : tensor<1xf32>) outs(%3 : tensor<1xf32>) -> tensor<1xf32>
scf.forall.in_parallel {
tensor.parallel_insert_slice %4 into %arg1[%i][1][1] : tensor<1xf32> into tensor<2xf32>
}
}
return
}
}
```
crash trace:
```
mlir-opt: /home/workdir/llvm-project-19/mlir/include/mlir/IR/Iterators.h:56: static auto mlir::ForwardDominanceIterator<true>::makeIterable(Region &) [NoGraphRegions = true]: Assertion `mayHaveSSADominance(region) && "graph regions are not allowed"' 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-ir-visitors
#0 0x000057535fe7d9b8 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (./mlir-opt+0x107f9b8)
#1 0x000057535fe7b4de llvm::sys::RunSignalHandlers() (./mlir-opt+0x107d4de)
#2 0x000057535fe7e3c8 SignalHandler(int) Signals.cpp:0:0
#3 0x000075eac61e0520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
#4 0x000075eac62349fc pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x969fc)
#5 0x000075eac61e0476 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x42476)
#6 0x000075eac61c67f3 abort (/lib/x86_64-linux-gnu/libc.so.6+0x287f3)
#7 0x000075eac61c671b (/lib/x86_64-linux-gnu/libc.so.6+0x2871b)
#8 0x000075eac61d7e96 (/lib/x86_64-linux-gnu/libc.so.6+0x39e96)
#9 0x0000575363024395 mlir::ForwardDominanceIterator<true>::makeIterable(mlir::Region&) (./mlir-opt+0x4226395)
#10 0x0000575363023d62 void mlir::detail::walk<mlir::ForwardDominanceIterator<true>>(mlir::Operation*, llvm::function_ref<void (mlir::Operation*)>, mlir::WalkOrder) (./mlir-opt+0x4225d62)
#11 0x0000575363024032 void mlir::detail::walk<mlir::ForwardDominanceIterator<true>>(mlir::Operation*, llvm::function_ref<void (mlir::Operation*)>, mlir::WalkOrder) (./mlir-opt+0x4226032)
#12 0x0000575363024032 void mlir::detail::walk<mlir::ForwardDominanceIterator<true>>(mlir::Operation*, llvm::function_ref<void (mlir::Operation*)>, mlir::WalkOrder) (./mlir-opt+0x4226032)
#13 0x0000575363023999 void llvm::function_ref<void (mlir::Operation*)>::callback_fn<std::enable_if<!llvm::is_one_of<mlir::FunctionOpInterface, mlir::Operation*, mlir::Region*, mlir::Block*>::value && std::is_same<void, void>::value, void>::type mlir::detail::walk<(mlir::WalkOrder)1, mlir::ForwardIterator, testPureCallbacks(mlir::Operation*)::$_3, mlir::FunctionOpInterface, void>(mlir::Operation*, testPureCallbacks(mlir::Operation*)::$_3&&)::'lambda'(mlir::Operation*)>(long, mlir::Operation*) TestVisitors.cpp:0:0
#14 0x000057535ff8fa2e void mlir::detail::walk<mlir::ForwardIterator>(mlir::Operation*, llvm::function_ref<void (mlir::Operation*)>, mlir::WalkOrder) (./mlir-opt+0x1191a2e)
#15 0x00005753630227e4 (anonymous namespace)::TestIRVisitorsPass::runOnOperation() TestVisitors.cpp:0:0
#16 0x000057536313708f mlir::detail::OpToOpPassAdaptor::run(mlir::Pass*, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int) (./mlir-opt+0x433908f)
#17 0x0000575363137872 mlir::detail::OpToOpPassAdaptor::runPipeline(mlir::OpPassManager&, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int, mlir::PassInstrumentor*, mlir::PassInstrumentation::PipelineParentInfo const*) (./mlir-opt+0x4339872)
#18 0x000057536313a01e mlir::PassManager::run(mlir::Operation*) (./mlir-opt+0x433c01e)
#19 0x0000575363132b3b performActions(llvm::raw_ostream&, std::shared_ptr<llvm::SourceMgr> const&, mlir::MLIRContext*, mlir::MlirOptMainConfig const&) MlirOptMain.cpp:0:0
#20 0x000057536313279b 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
#21 0x00005753631dcf25 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+0x43def25)
#22 0x000057536312d682 mlir::MlirOptMain(llvm::raw_ostream&, std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, mlir::DialectRegistry&, mlir::MlirOptMainConfig const&) (./mlir-opt+0x432f682)
#23 0x000057536312d933 mlir::MlirOptMain(int, char**, llvm::StringRef, llvm::StringRef, mlir::DialectRegistry&) (./mlir-opt+0x432f933)
#24 0x000057536312db42 mlir::MlirOptMain(int, char**, llvm::StringRef, mlir::DialectRegistry&) (./mlir-opt+0x432fb42)
#25 0x000057535fe5cbd7 main (./mlir-opt+0x105ebd7)
#26 0x000075eac61c7d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#27 0x000075eac61c7e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#28 0x000057535fe5c745 _start (./mlir-opt+0x105e745)
Aborted (core dumped)
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzsWV1z4yrS_jXkhopLAn1e5MJJxu9J1cmbVDK1e-lCUstmg0ELKB__fgskW5YSJeM5s7VnT23VTCwB3f30092AgBnDNxLgAsWXKL4-Y63dKn3xyg2Tm-CsUNXbxXcwFiuJS7XbcYvoEm-tbQyiS0RWiKw23G7bYlGqHSIrIZ73P-eNVv-A0iKy6kXJKkpzkrEiTIokjcswzUjCKhYmNaGMBXGSQ05ZlEYouEbB0lhoDLYKa2i0qtoSnFHfhZKg_-dfd4Lrc9VYbMHYhXvD5-7xnOvzZ264Vdp8KOgG4ZKZec2qagWg9LJ7xbhuZblwfzCKgro1sNbQALNQIZIhEtdcCEeSBWmURvSKvNaUIPoNkSuMSKxa27R2ZkSOjyxhN7wMMKLXmGlut4tSSWOZtDhYuOYldnLHo7vBgksmNguHBHNpOlzlIEFyrFprBrx4Fs45ot8-6OlsIhKH3qAp60WtNHOavFLuZLl0b96c2TIN1XqwyvSmEx0Y2VtDJPuaGe8t8Rq6wQt4tZqVdm0EL8Fz4XLaQYmvUXwZDj8fe-vy7NAYjh3dG6SfGnQ-_Xqb0XFIQcDuhRtY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