[llvm] [AArch64] Fix the assertion failure on `RegisterVT == PartVT && "Part… (PR #170632)

Cheng Lingfei via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 10 06:56:00 PDT 2026


================

----------------
clingfei wrote:

I am not sure. I compiled the following C code with GCC:
```
typedef int v8si __attribute__((vector_size(32)));

void foo(int val)
{
  register v8si y asm("z1");
  register v8si x asm("z0");
  v8si z;
  const v8si mask = { -1, 0, 0, -1, 0, -1, 0, -1 };
  const v8si zero = { 0, 0, 0, 0, 0, 0, 0, 0 };
  v8si cond;
  int next = val + 1;

  asm volatile ("" : "=w" (y));
  z = (v8si) { next, next, next, next, next, next, next, next };
  cond = mask != zero;
  x = (cond & z) | (~cond & y);
  asm volatile ("" :: "w" (x));
}
```
, which dumps GIMPLE (seems to be equivalent with the LLVM IR) as follows:
```
void foo (int val)
{
  register v8si y __asm__ (*z1);
  register v8si x __asm__ (*z0);
  v8si z;
  const v8si mask;
  const v8si zero;
  v8si cond;
  int next;
  v8si D.3853 = {next, next, next, next, next, next, next, next};

  mask = { -1, 0, 0, -1, 0, -1, 0, -1 };
  zero = { 0, 0, 0, 0, 0, 0, 0, 0 };
  next = val + 1;
  __asm__ __volatile__("" : "=w" y);
  z = {next, next, next, next, next, next, next, next};
  _1 = mask != zero;
  cond = VEC_COND_EXPR <_1, { -1, -1, -1, -1, -1, -1, -1, -1 }, { 0, 0, 0, 0, 0, 0, 0, 0 }>;
  _2 = cond & z;
  _3 = ~cond;
  y.0_4 = y;
  _5 = _3 & y.0_4;
  _6 = _2 | _5;
  x = _6;
  __asm__ __volatile__("" :  : "w" x);
}
```
and GCC does not crash. 

However, the C code also does not cause LLVM to crash. The crash may only be triggered by the LLVM IR.

https://github.com/llvm/llvm-project/pull/170632


More information about the llvm-commits mailing list