<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/71036>71036</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[mlir][vector] --lower-vector-mask causes segmentation fault
</td>
</tr>
<tr>
<th>Labels</th>
<td>
mlir
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
anonymousMCS
</td>
</tr>
</table>
<pre>
git version: ba0763e4cb08015bd0acef5cf05a372d423017b4
system: ```Ubuntu 20.04.6 LTS (Focal Fossa)```
reproduced with: ```mlir-opt --lower-vector-mask a.mlir```
a.mlir:
```
func.func nested @func1() {
%cst_0 = arith.constant 4.102400e+04 : f16
%false = arith.constant false
%34 = vector.broadcast %cst_0 : f16 to vector<1xf16>
%35 = vector.broadcast %false : i1 to vector<1xi1>
%36 = vector.mask %35 { vector.multi_reduction <maxf>, %34, %34 [] : vector<1xf16> to vector<1xf16> } : vector<1xi1> -> vector<1xf16>
%40 = vector.extract_strided_slice %36 {offsets = [0], sizes = [1], strides = [1]} : vector<1xf16> to vector<1xf16>
vector.print %40 : vector<1xf16>
return
}
```
trace:
```
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0. Program arguments: /data/bin/llvm-project/build/bin/mlir-opt --lower-vector-mask a.mlir
#0 0x000055d07b46d99f llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/data/bin/llvm-project/build/bin/mlir-opt+0x15db99f)
#1 0x000055d07b46aa34 SignalHandler(int) Signals.cpp:0:0
#2 0x00007f6dad97f420 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x14420)
#3 0x000055d07c167d15 mlir::OpInterface<mlir::vector::MaskableOpInterface, mlir::vector::detail::MaskableOpInterfaceInterfaceTraits>::getInterfaceFor(mlir::Operation*) (/data/bin/llvm-project/build/bin/mlir-opt+0x22d5d15)
#4 0x000055d07d48e932 (anonymous namespace)::MaskOpRewritePattern<mlir::vector::TransferReadOp>::matchAndRewrite(mlir::vector::MaskOp, mlir::PatternRewriter&) const LowerVectorMask.cpp:0:0
#5 0x000055d07d3be72a mlir::detail::OpOrInterfaceRewritePatternBase<mlir::vector::MaskOp>::matchAndRewrite(mlir::Operation*, mlir::PatternRewriter&) const (/data/bin/llvm-project/build/bin/mlir-opt+0x352c72a)
#6 0x000055d080cec408 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&)>) (/data/bin/llvm-project/build/bin/mlir-opt+0x6e5a408)
#7 0x000055d07e09813c (anonymous namespace)::GreedyPatternRewriteDriver::processWorklist() GreedyPatternRewriteDriver.cpp:0:0
#8 0x000055d07e09c5ab mlir::applyPatternsAndFoldGreedily(mlir::Region&, mlir::FrozenRewritePatternSet const&, mlir::GreedyRewriteConfig, bool*) (/data/bin/llvm-project/build/bin/mlir-opt+0x420a5ab)
#9 0x000055d07d489be4 (anonymous namespace)::LowerVectorMaskPass::runOnOperation() LowerVectorMask.cpp:0:0
#10 0x000055d07dfe2bce mlir::detail::OpToOpPassAdaptor::run(mlir::Pass*, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int) (/data/bin/llvm-project/build/bin/mlir-opt+0x4150bce)
#11 0x000055d07dfe30aa mlir::detail::OpToOpPassAdaptor::runPipeline(mlir::OpPassManager&, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int, mlir::PassInstrumentor*, mlir::PassInstrumentation::PipelineParentInfo const*) (/data/bin/llvm-project/build/bin/mlir-opt+0x41510aa)
#12 0x000055d07dfe3aac mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool)::'lambda'(mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool)::OpPMInfo&)::operator()(mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool)::OpPMInfo&) const Pass.cpp:0:0
#13 0x000055d07dfe2205 mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool) (/data/bin/llvm-project/build/bin/mlir-opt+0x4150205)
#14 0x000055d07dfe296a mlir::detail::OpToOpPassAdaptor::run(mlir::Pass*, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int) (/data/bin/llvm-project/build/bin/mlir-opt+0x415096a)
#15 0x000055d07dfe30aa mlir::detail::OpToOpPassAdaptor::runPipeline(mlir::OpPassManager&, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int, mlir::PassInstrumentor*, mlir::PassInstrumentation::PipelineParentInfo const*) (/data/bin/llvm-project/build/bin/mlir-opt+0x41510aa)
#16 0x000055d07dfe38d4 mlir::PassManager::run(mlir::Operation*) (/data/bin/llvm-project/build/bin/mlir-opt+0x41518d4)
#17 0x000055d07dfd465b performActions(llvm::raw_ostream&, std::shared_ptr<llvm::SourceMgr> const&, mlir::MLIRContext*, mlir::MlirOptMainConfig const&) MlirOptMain.cpp:0:0
#18 0x000055d07dfd5b14 processBuffer(llvm::raw_ostream&, std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, mlir::MlirOptMainConfig const&, mlir::DialectRegistry&, llvm::ThreadPool*) MlirOptMain.cpp:0:0
#19 0x000055d07dfd5cc4 mlir::LogicalResult llvm::function_ref<mlir::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&)::'lambda'(std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, llvm::raw_ostream&)>(long, std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, llvm::raw_ostream&) MlirOptMain.cpp:0:0
#20 0x000055d07e0d4c24 mlir::splitAndProcessBuffer(std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, llvm::function_ref<mlir::LogicalResult (std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, llvm::raw_ostream&)>, llvm::raw_ostream&, bool, bool) (/data/bin/llvm-project/build/bin/mlir-opt+0x4242c24)
#21 0x000055d07dfce777 mlir::MlirOptMain(llvm::raw_ostream&, std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, mlir::DialectRegistry&, mlir::MlirOptMainConfig const&) (/data/bin/llvm-project/build/bin/mlir-opt+0x413c777)
#22 0x000055d07dfd5e11 mlir::MlirOptMain(int, char**, llvm::StringRef, llvm::StringRef, mlir::DialectRegistry&) (/data/bin/llvm-project/build/bin/mlir-opt+0x4143e11)
#23 0x000055d07dfd6276 mlir::MlirOptMain(int, char**, llvm::StringRef, mlir::DialectRegistry&) (/data/bin/llvm-project/build/bin/mlir-opt+0x4144276)
#24 0x000055d07b3a4ddb main (/data/bin/llvm-project/build/bin/mlir-opt+0x1512ddb)
#25 0x00007f6dad44b083 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x24083)
#26 0x000055d07b43e06e _start (/data/bin/llvm-project/build/bin/mlir-opt+0x15ac06e)
Segmentation fault (core dumped)
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzsWl1T4zoS_TXmRUVKlr8feAiB7E7VUFDA7j6mZKmdaFEkryQzcH_9lmwnsfMB3IGdvXdrp2YywW61zjnqbrcsqLViqQAuguQySK7OaONW2lxQpdXrWjf2ZvZwVmr-erEUDj2DsUKrIJqikuIsjSBmJc5xmJQcUwZVwiqc0CgjPCYRDrMyDvBVgKfdp321DtZ-dJDi7u_fyka5BhE8wfEkRd8fH1BA8rlmVKK5tpYGpNgaD30ZqI3mDQOOfgi3GjldS2HOde3Q-bnUP8CcPwNz2pyvqX1CdOJvH_XZ34r6H_d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