<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/116852>116852</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Assertion `I->use_empty() && "trying to erase instruction with users."' failed.
</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>
To reproduce run the test below with -passes=slp-vectorizer
```
; ModuleID = './reduced.ll'
source_filename = "./reduced.ll"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128-ni:1-p2:32:8:8:32-ni:2"
target triple = "x86_64-unknown-linux-gnu"
define void @wombat() gc "statepoint-example" {
bb:
br label %bb1
bb1: ; preds = %bb1, %bb
%phi = phi i32 [ 0, %bb ], [ %or21, %bb1 ]
%sitofp = sitofp i32 0 to float
%fadd = fadd float %sitofp, %sitofp
%fadd2 = fadd float %fadd, 0.000000e+00
%fcmp = fcmp ogt float %fadd2, 0.000000e+00
%select = select i1 %fcmp, i32 0, i32 0
%select3 = select i1 false, i32 %select, i32 0
%fadd4 = fadd float %sitofp, 0.000000e+00
%fadd5 = fadd float %fadd4, 0.000000e+00
%fcmp6 = fcmp ogt float %fadd5, 0.000000e+00
%select7 = select i1 %fcmp6, i32 0, i32 0
%select8 = select i1 false, i32 %select7, i32 0
%or = or i32 %select3, %select8
%sitofp9 = sitofp i32 0 to float
%fmul = fmul float 0.000000e+00, 0.000000e+00
%fadd10 = fadd float %sitofp9, %fmul
%fadd11 = fadd float %fadd10, 0.000000e+00
%fcmp12 = fcmp ogt float %fadd11, 0.000000e+00
%select13 = select i1 %fcmp12, i32 0, i32 0
%select14 = select i1 false, i32 %select13, i32 0
%or15 = or i32 %select14, %or
%fadd16 = fadd float %fmul, 0.000000e+00
%fadd17 = fadd float %fadd16, 0.000000e+00
%fcmp18 = fcmp ogt float %fadd17, 0.000000e+00
%select19 = select i1 %fcmp18, i32 0, i32 0
%select20 = select i1 false, i32 %select19, i32 0
%or21 = or i32 %or15, %select20
br label %bb1
}
```
Reproducer: https://godbolt.org/z/T8j1xEoKM
Stack dump:
```
0. Program arguments: /opt/compiler-explorer/clang-assertions-trunk/bin/opt -o /app/output.s -S -passes=slp-vectorizer <source>
1. Running pass "function(slp-vectorizer)" on module "<source>"
2. Running pass "slp-vectorizer" on function "wombat"
#0 0x0000000005194b38 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x5194b38)
#1 0x000000000519252c SignalHandler(int) Signals.cpp:0:0
#2 0x00007eacdf842520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
#3 0x00007eacdf8969fc pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x969fc)
#4 0x00007eacdf842476 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x42476)
#5 0x00007eacdf8287f3 abort (/lib/x86_64-linux-gnu/libc.so.6+0x287f3)
#6 0x00007eacdf82871b (/lib/x86_64-linux-gnu/libc.so.6+0x2871b)
#7 0x00007eacdf839e96 (/lib/x86_64-linux-gnu/libc.so.6+0x39e96)
#8 0x000000000419bb4f (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x419bb4f)
#9 0x000000000425f0bf llvm::SLPVectorizerPass::runImpl(llvm::Function&, llvm::ScalarEvolution*, llvm::TargetTransformInfo*, llvm::TargetLibraryInfo*, llvm::AAResults*, llvm::LoopInfo*, llvm::DominatorTree*, llvm::AssumptionCache*, llvm::DemandedBits*, llvm::OptimizationRemarkEmitter*) (.part.0) SLPVectorizer.cpp:0:0
#10 0x000000000425fa7b llvm::SLPVectorizerPass::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x425fa7b)
#11 0x0000000002fbe41e llvm::detail::PassModel<llvm::Function, llvm::SLPVectorizerPass, llvm::AnalysisManager<llvm::Function>>::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x2fbe41e)
#12 0x0000000004f949e8 llvm::PassManager<llvm::Function, llvm::AnalysisManager<llvm::Function>>::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x4f949e8)
#13 0x0000000000e4027e llvm::detail::PassModel<llvm::Function, llvm::PassManager<llvm::Function, llvm::AnalysisManager<llvm::Function>>, llvm::AnalysisManager<llvm::Function>>::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0xe4027e)
#14 0x0000000004f9340e llvm::ModuleToFunctionPassAdaptor::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x4f9340e)
#15 0x0000000000e3f92e llvm::detail::PassModel<llvm::Module, llvm::ModuleToFunctionPassAdaptor, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0xe3f92e)
#16 0x0000000004f92e40 llvm::PassManager<llvm::Module, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x4f92e40)
#17 0x0000000000909fda llvm::runPassPipeline(llvm::StringRef, llvm::Module&, llvm::TargetMachine*, llvm::TargetLibraryInfoImpl*, llvm::ToolOutputFile*, llvm::ToolOutputFile*, llvm::ToolOutputFile*, llvm::StringRef, llvm::ArrayRef<llvm::PassPlugin>, llvm::ArrayRef<std::function<void (llvm::PassBuilder&)>>, llvm::opt_tool::OutputKind, llvm::opt_tool::VerifierKind, bool, bool, bool, bool, bool, bool, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x909fda)
#18 0x00000000008fc70a optMain (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x8fc70a)
#19 0x00007eacdf829d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#20 0x00007eacdf829e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#21 0x00000000008f3e9e _start (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x8f3e9e)
Program terminated with signal: SIGSEGV
Compiler returned: 139
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzcWd9v46gT_2voC3IE-PdDHtKmue_qrrrVttrXCts44RaDBXjb7l__FdhJY9fJpnc96bRVk2Az82HmMwMMNjWGbyVjSxBfg3h9RTu7U3r5QO0LlXStusKaq0JVL8sHBTVrtaq6kkHdSWh3DFpmLCyYUE_widsdDFpqDDMgXBvRBt9ZaZXmP5gGaA3QCiRo-O8vw2t4p6pOsE9rCMI1BCRdALLRzI1RLYQAJO1Fjep0yR5rLpikDRukyVSa9NKW6i2zsKKWCvqiOruXZ0EDwhULWpIiEK5C4r_cJR5fulYS-a-AHxqYZCBcYZIFdYaGlvS3kr16EgX3_jZ3t4OW7Duy4ROSvo9MrbWat-Lg2XOWPCZR0MlvUj3JQHDZPQdb2R20-u-K1Vwy-F3xCoIIPammoBaQDJAcbksHZCy1rFVc2oA906YVDBACQXrdAxQFCAcsCAsNBS2YgIDERYGPB3KX4Qq6kLWaVWaw04uRm761hwEkbnfcS7hfHhII4muIDoIQxGt_EV-7G0qTVxDsO1-RDLeqbj3Y0HR4CFoFa6GoPRKtaVV5Qd_wva8IwwDDxViJzGi5K6eDFsj_MUCu0ZC4vr9seqt8Q23tWJWc1PVWMMHKPiuHJsd7UKfoXXxtTBXDiWZNhWF78YPUnL4zLTrL0UmbnUJ8gqjovGbZtMkZruILuErnyUouYCu7iK10DkBpr6v0WDbcJ1OP_yZb88vStelEz4pr9IxMWDiXf7SqMDoZynww0WFPgojxiSji0wPu-cbkTBwxPmdwTxae5u4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