<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/72720>72720</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[ARM][VPlan] Assertion with -mcpu=neoverse-v1 - Invalid operands for select instruction!
</td>
</tr>
<tr>
<th>Labels</th>
<td>
vectorization,
crash
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
mcinally
</td>
</tr>
</table>
<pre>
Possibly a side-effect from Issue #70988...
LoopVectorize is generating @llvm.get.active.lane.mask calls with a <1 x i1> return type. E.g.:
`
%active.lane.mask.entry = call <1 x i1> @llvm.get.active.lane.mask.v1i1.i32(i32 0, i32 15)
`
The Verifier later blows up on this single element vector mask. E.g.:
`
Invalid operands for select instruction!
%13 = select contract <1 x i1> %active.lane.mask, float %6, float -0.000000e+00
`
Test case to reproduce:
```
$ cat test.ll
source_filename = "test.ll"
target triple = "arm64-linux"
define dso_local void @foo() #0 {
entry:
br label %loop
loop: ; preds = %loop, %entry
%x.addr.0 = phi float [ undef, %entry ], [ %5, %loop ]
%y.addr.0 = phi i32 [ 0, %entry ], [ %narrow, %loop ]
%narrow = add nuw nsw i32 %y.addr.0, 1
%0 = load i32, ptr null, align 4
%1 = ashr i32 %0, 1
%2 = sext i32 %1 to i64
%3 = getelementptr float, ptr null, i64 %2
%4 = load float, ptr %3, align 4
%5 = fadd contract float %x.addr.0, %4
%6 = icmp ult i32 %narrow, 15
br i1 %6, label %loop, label %exit, !llvm.loop !0
exit: ; preds = %loop
%.lcssa = phi float [ %5, %loop ]
%7 = fadd contract float %.lcssa, 0.000000e+00
store float %7, ptr null, align 4294967296
ret void
}
!0 = distinct !{!0, !1}
!1 = !{!"llvm.loop.interleave.count", i32 2}
$ opt -passes=loop-vectorize -mcpu=neoverse-v1 -S test.ll
Invalid operands for select instruction!
%13 = select contract <1 x i1> %active.lane.mask, float %6, float -0.000000e+00
Invalid operands for select instruction!
%15 = select contract <1 i1> %active.lane.mask2, float %12, float -0.000000e+00
LLVM ERROR: Broken module found, compilation aborted!
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0. Program arguments: opt -passes=loop-vectorize -mcpu=neoverse-v1 -S test.ll
#0 0x0000aaaae5745b18 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (opt+0x1795b18)
#1 0x0000aaaae5743b08 llvm::sys::RunSignalHandlers() (opt+0x1793b08)
#2 0x0000aaaae5746388 SignalHandler(int) Signals.cpp:0:0
#3 0x0000400007f1064c (linux-vdso.so.1+0x64c)
#4 0x0000400008122c1c raise (/lib64/libc.so.6+0x32c1c)
#5 0x00004000081107a8 abort (/lib64/libc.so.6+0x207a8)
#6 0x0000aaaae56d1438 llvm::report_fatal_error(llvm::Twine const&, bool) (opt+0x1721438)
#7 0x0000aaaae56d1264 llvm::report_fatal_error(llvm::Twine const&, bool) (opt+0x1721264)
#8 0x0000aaaae5391834 llvm::VerifierPass::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (opt+0x13e1834)
#9 0x0000aaaae5369778 llvm::PassManager<llvm::Module, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (opt+0x13b9778)
#10 0x0000aaaae44fd5e0 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+0x54d5e0)
#11 0x0000aaaae4509b30 main (opt+0x559b30)
#12 0x0000400008110be4 __libc_start_main (/lib64/libc.so.6+0x20be4)
#13 0x0000aaaae44f7d5c _start (opt+0x547d5c)
Aborted (core dumped)
```
@ktkachov-arm @paulwalker-arm @fhahn
</pre>
<img width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