<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/88297>88297</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Assertion `verifyVPlanIsValid(*Plan) && "VPlan is invalid"' 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>
The following test fails when run opt with -passes loop-vectorize
```
; 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 = %bb2, %bb
%phi = phi i32 [ %add, %bb2 ], [ 0, %bb ]
br i1 false, label %bb2, label %bb4
bb2: ; preds = %bb4, %bb1
%phi3 = phi i64 [ 1, %bb4 ], [ 0, %bb1 ]
%add = add i32 %phi, 1
%icmp = icmp sgt i32 %phi, 0
br i1 %icmp, label %bb5, label %bb1
bb4: ; preds = %bb1
br label %bb2
bb5: ; preds = %bb2
%phi6 = phi i64 [ %phi3, %bb2 ]
ret void
}
```
Reproducer https://godbolt.org/z/9YW1o7qo6
Stack dump:
```
Found non-header PHI recipe in header VPBB: BLEND ir<%phi3> = ir<1> ir<0>/ir<false>
opt: /root/llvm-project/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp:8555: void llvm::LoopVectorizationPlanner::buildVPlansWithVPRecipes(llvm::ElementCount, llvm::ElementCount): Assertion `verifyVPlanIsValid(*Plan) && "VPlan is invalid"' failed.
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0. Program arguments: /opt/compiler-explorer/clang-assertions-trunk/bin/opt -o /app/output.s -S -passes loop-vectorize <source>
#0 0x0000000004d05ee8 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x4d05ee8)
#1 0x0000000004d0363c SignalHandler(int) Signals.cpp:0:0
#2 0x00007f7623242520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
#3 0x00007f76232969fc pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x969fc)
#4 0x00007f7623242476 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x42476)
#5 0x00007f76232287f3 abort (/lib/x86_64-linux-gnu/libc.so.6+0x287f3)
#6 0x00007f762322871b (/lib/x86_64-linux-gnu/libc.so.6+0x2871b)
#7 0x00007f7623239e96 (/lib/x86_64-linux-gnu/libc.so.6+0x39e96)
#8 0x0000000003de70b8 llvm::LoopVectorizationPlanner::buildVPlansWithVPRecipes(llvm::ElementCount, llvm::ElementCount) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x3de70b8)
#9 0x0000000003dee731 llvm::LoopVectorizationPlanner::plan(llvm::ElementCount, unsigned int) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x3dee731)
#10 0x0000000003df18fe llvm::LoopVectorizePass::processLoop(llvm::Loop*) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x3df18fe)
#11 0x0000000003df4c6d llvm::LoopVectorizePass::runImpl(llvm::Function&, llvm::ScalarEvolution&, llvm::LoopInfo&, llvm::TargetTransformInfo&, llvm::DominatorTree&, llvm::BlockFrequencyInfo*, llvm::TargetLibraryInfo*, llvm::DemandedBits&, llvm::AssumptionCache&, llvm::LoopAccessInfoManager&, llvm::OptimizationRemarkEmitter&, llvm::ProfileSummaryInfo*) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x3df4c6d)
#12 0x0000000003df5e7b llvm::LoopVectorizePass::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x3df5e7b)
#13 0x0000000002d67f0e llvm::detail::PassModel<llvm::Function, llvm::LoopVectorizePass, llvm::AnalysisManager<llvm::Function>>::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x2d67f0e)
#14 0x0000000000db3554 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+0xdb3554)
#15 0x0000000004b1663e llvm::ModuleToFunctionPassAdaptor::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x4b1663e)
#16 0x0000000000d97cce 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+0xd97cce)
#17 0x0000000004b1454c llvm::PassManager<llvm::Module, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x4b1454c)
#18 0x00000000008c74f2 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+0x8c74f2)
#19 0x00000000008bad45 optMain (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x8bad45)
#20 0x00007f7623229d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#21 0x00007f7623229e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#22 0x00000000008b1aee _start (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x8b1aee)
Program terminated with signal: SIGSEGV
Compiler returned: 139
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzcWV1z6jgS_TXKiwrKlr_wAw8QYCa1NzvUJZWpfUrJdhu0kSWPJOdjfv2WZEOwA7PhDls7NakELKl1-pzulmwrVGu2FQBTFM1RtLihjdlJNX2g5p0KupBNZvRNJov36cMOcCk5l69MbLEBbXBJGdf4dQcCq0ZgWRv8yswOj2qqNWjMpaxHL5AbqdjvgLwF8mYo9rrfthnM8b0sGg53C4yCBUYkGSOyUlA0ORRjzhFJWlMtG5XDU8k4CFpBZ02G1qS1NlRtweCCGsrpu2zM3h5GFQpmMKpJ4qFgFhD3YZt-v2mv4tB9jNjhwicTFMx8MhmVE6-7Eq4r3k-Pw9HGdTPbParJfmDS_QWkHSNDtkaxmh-UvU3ipzgcNeJZyFcx4kw0b6OtaA6z2s8CSiYAv0hWYBR6r7LKqEFkgkiKt7kF0oYaqCUTZgRvtKo5IEIwSuYtQJahoMPCOFOY0ww4RiTKMv_YkW0GM2xTVisodMczyjKCyG17tYdBJKp3zFnYbxYQjKK57aZFcbC2nQvXiubYO3S73g8-zMcl5Rrs-BE3MmiHfa7kDNfw4Mbvkw0-2MahY-QfTMPTRP1jpq02B2K_nWQHbM2PfbG8qp2Zu9BbM7D1-tq7GQO10aA9yFR4Rr1_Os-kPzuysy_6OVkUvfDGn8LbhX1QDd0kBcaVdEcsWZzcPr5DraRd-wrvjKm1LWSyQmS1lUUmuRlLtUVk9Tsiq_Rfv_oy-U3G7cyNofkzLpqqPhT_AHslG1FgIcVoB7QAhdc_32EFOasBM4G7zsf1fG6jNf-2_OcCM4WC272uYNlm2fb5tuWuPBQsEVm567asg2XrUNbGZY2slJQGkRXnL9WoVvLfkO-b9otliKweFBW6lKrSiK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