Issue 164182
Summary [AArch64] unexpected element count for vector
Labels backend:AArch64
Assignees
Reporter sjoerdmeijer
    This IR:

```
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128-Fn32"
target triple = "aarch64-unknown-linux-gnu"

define i1 @_Z1kbxiPA9_l(<vscale x 1 x i1> %0) #0 {
entry:
  %1 = extractelement <vscale x 1 x i1> %0, i64 0
 ret i1 %1
}

attributes #0 = { "target-cpu"="grace" }
```

triggers this crash:

```
unexpected element count for vector
UNREACHABLE executed at /root/llvm-project/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp:227!
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace and instructions to reproduce the bug.
Stack dump:
0.	Program arguments: /opt/compiler-explorer/clang-assertions-trunk/bin/llc -o /app/output.s -x86-asm-syntax=intel -mtriple=aarch64 <source>
1.	Running pass 'Function Pass Manager' on module '<source>'.
2.	Running pass 'AArch64 Instruction Selection' on function '@_Z1kbxiPA9_l'
 #0 0x0000000004159828 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x4159828)
 #1 0x00000000041566d4 SignalHandler(int, siginfo_t*, void*) Signals.cpp:0:0
 #2 0x0000764991c42520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
 #3 0x0000764991c969fc pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x969fc)
 #4 0x0000764991c42476 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x42476)
 #5 0x0000764991c287f3 abort (/lib/x86_64-linux-gnu/libc.so.6+0x287f3)
 #6 0x000000000409a2fa (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x409a2fa)
 #7 0x0000000000d736a0 llvm::AArch64TargetLowering::LowerEXTRACT_VECTOR_ELT(llvm::SDValue, llvm::SelectionDAG&) const (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0xd736a0)

```

See also: https://godbolt.org/z/dz6YGMd1v


This looks similar to other problems with i1 vectors, but am raising this because haven't seen this assert and unreachable before. 


Can be triggered from source-code:

```
#include <algorithm>
bool a;
extern bool j[];
int b;
void k(bool c, long long d, int e, long f[][9]) {
  for (char g;; g += 6)
    for (char h = 0; h < b; h++)
      for (int i = 3; i; i += f[6][1]) {
        j[g] = (f[g][h] ? e : 0) ?: std::min((long long)1, d & 7);
 a &= (bool)std::max((long long)c,
 std::min((long long)-9, 9069140490975LL));
      }
}
```
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to