<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/73554>73554</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
LLVM ERROR: Loop pass manager using MemorySSA contains a pass that does not preserve MemorySSA
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
TatyanaDoubts
</td>
</tr>
</table>
<pre>
The bug was found by FuzzGen IR test generator
Run opt with '-passes=loop-mssa(canon-freeze,simple-loop-unswitch<nontrivial>)'
https://godbolt.org/z/1rWr1zP6G
Test.ll
```
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"
define i16 @function_0() {
entry_1:
br label %prhdr_loop_3
prhdr_loop_3: ; preds = %be_6, %loop_4, %entry_1
%ptr_i1_32.0 = phi i1 [ false, %entry_1 ], [ %val_i1_53, %be_6 ], [ %val_i1_53, %loop_4 ]
%val_i1_53 = add i1 %ptr_i1_32.0, true
br label %loop_4
loop_4: ; preds = %be_6, %prhdr_loop_3
br i1 false, label %be_6, label %prhdr_loop_3
be_6: ; preds = %loop_4
br i1 %ptr_i1_32.0, label %loop_4, label %prhdr_loop_3
; uselistorder directives
uselistorder i1 %val_i1_53, { 1, 0 }
}
```
Stack dump
```
Stack dump:
0. Program arguments: /opt/compiler-explorer/clang-17.0.1/bin/opt -o /app/output.s -S -passes=loop-mssa(canon-freeze,simple-loop-unswitch<nontrivial>) <source>
#0 0x000000000314b7f8 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-17.0.1/bin/opt+0x314b7f8)
#1 0x00000000031493bc SignalHandler(int) Signals.cpp:0:0
#2 0x00007f8c91442520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
#3 0x00007f8c914969fc pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x969fc)
#4 0x00007f8c91442476 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x42476)
#5 0x00007f8c914287f3 abort (/lib/x86_64-linux-gnu/libc.so.6+0x287f3)
#6 0x0000000000786380 llvm::RISCVISAInfo::updateImplication() (.cold) RISCVISAInfo.cpp:0:0
#7 0x00000000030a4f68 (/opt/compiler-explorer/clang-17.0.1/bin/opt+0x30a4f68)
#8 0x0000000003db7db1 llvm::FunctionToLoopPassAdaptor::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (/opt/compiler-explorer/clang-17.0.1/bin/opt+0x3db7db1)
#9 0x000000000336ec7e llvm::detail::PassModel<llvm::Function, llvm::FunctionToLoopPassAdaptor, llvm::PreservedAnalyses, llvm::AnalysisManager<llvm::Function>>::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (/opt/compiler-explorer/clang-17.0.1/bin/opt+0x336ec7e)
#10 0x0000000000cb5a9a llvm::detail::PassModel<llvm::Function, llvm::PassManager<llvm::Function, llvm::AnalysisManager<llvm::Function>>, llvm::PreservedAnalyses, llvm::AnalysisManager<llvm::Function>>::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (/opt/compiler-explorer/clang-17.0.1/bin/opt+0xcb5a9a)
#11 0x0000000002ad64d6 llvm::ModuleToFunctionPassAdaptor::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/opt/compiler-explorer/clang-17.0.1/bin/opt+0x2ad64d6)
#12 0x0000000000cac2be llvm::detail::PassModel<llvm::Module, llvm::ModuleToFunctionPassAdaptor, llvm::PreservedAnalyses, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/opt/compiler-explorer/clang-17.0.1/bin/opt+0xcac2be)
#13 0x000000000089780f llvm::runPassPipeline(llvm::StringRef, llvm::Module&, llvm::TargetMachine*, llvm::TargetLibraryInfoImpl*, llvm::ToolOutputFile*, llvm::ToolOutputFile*, llvm::ToolOutputFile*, llvm::StringRef, llvm::ArrayRef<llvm::PassPlugin>, llvm::opt_tool::OutputKind, llvm::opt_tool::VerifierKind, bool, bool, bool, bool, bool, bool, bool) (/opt/compiler-explorer/clang-17.0.1/bin/opt+0x89780f)
#14 0x00000000007a005b main (/opt/compiler-explorer/clang-17.0.1/bin/opt+0x7a005b)
#15 0x00007f8c91429d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#16 0x00007f8c91429e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#17 0x000000000088c99e _start (/opt/compiler-explorer/clang-17.0.1/bin/opt+0x88c99e)
Program terminated with signal: SIGSEGV
Compiler returned: 139
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzkWFtv4yAW_jXkBSWywfHlIQ9pO5mtdqqpmmr2McLmxGGHgAW4bfrrV2CnDW3n0ulIu9JWaYLhXL7zHTiAmbWiVQALND9D84sJ691Om8Utcwem2IXua2cnteaHxe0OcN23-J5ZvNW94rg-4FX_-PgZFL68wQ6swy0oMMxpg5ILlCyH75teYd05fC_cDiNSTDtmLVhEL6TW3XRvLUOkbJjSaro1AI-AyLkV-07CNEj0yt4L1-wQPVdaOSPuBJOIfkKkQqQ4dbVzrrOILhFZIbJqNa-1dDNtWkRWj4isUvMvkz5e559PlW7BupmUY1eejJ_w6JhpwWHOHJPsoHuHEb3AiBCY7hFdwlTkGaLLPJtuywTRZUrKqSp9I0d0Sckwtk5JiQiJTDojOglHcw9lvsmzaa--K32vplKo_mHaqv5Ja_jmsBUKsEhzjLJk26vGCa02CfL2K4yKs0EOlDOHTeqZCM8Y1wZLVoPEiMw7s-Nm46nd0FPrUT9dYkTPcGeA2xHlvIZNjsi5bwapbHw4uht9eRfObES6oWSWBOVuJ7BIMZqf4S2TFmJFjOYXoWd-5nvvmPTKczpKebe_EBngBKFnEE9CAQLjPECIwHl1Z3p4i6YxxBOCxh66xL__9zMSXyciIBDpM0lPaI5qv8xiEHwXxDdAnsZ-xPSauZdU_Q4876q3IIV12nAwm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