llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
27.19k stars 11.13k forks source link

[AArch64] [CodeView] unknown codeview register Z0 #91187

Open mstorsjo opened 2 months ago

mstorsjo commented 2 months ago

If trying to compile code that uses SVE, with CodeView debug info enabled, one easily hits this error.

To reproduce:

#include <arm_neon_sve_bridge.h>

uint64_t aom_sum_squares_2d_i16_wxh_sve() {
  svint64_t sum_squares = svdup_n_s64(0);
  return svaddv_s64(svptrue_b64(), sum_squares);
}
$ clang -target aarch64-windows-gnu -c sve-debuginfo.c -march=armv8.2-a+sve -O2 -g -gcodeview
fatal error: error in backend: unknown codeview register Z0

Fixing this requires MS to define how the SVE registers are to be expressed in codeview debug info.

CC @pmsjt @dpaoliello

(This issue was mentioned in https://github.com/llvm/llvm-project/issues/64278#issuecomment-2081507917, but splitting this out to a separate issue, as it's unrelated to the previous one.)

If not compiling with -O2, one hits #80009 instead. But once that is implemented correctly, we still need codeview definitions for these registers.

Also as a side note, if trying to build with -target aarch64-windows-msvc, one hits these errors instead:

In file included from <prefix>/lib/clang/19/include/arm_neon_sve_bridge.h:15:
<prefix>/lib/clang/19/include/arm_sve.h:271:1: error: cannot mangle this built-in __SVInt8_t type yet
  271 | __aio __attribute__((target("sve"))) svint8_t svreinterpret_s8(svint8_t op) __arm_streaming_compatible {
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  272 |   return __builtin_sve_reinterpret_s8_s8(op);
      |   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  273 | }
      | ~
<prefix>/lib/clang/19/include/arm_sve.h:125:15: note: expanded from macro '__aio'
  125 | #define __aio static __inline__ __attribute__((__always_inline__, __nodebug__, __overloadable__))
      |               ^
<prefix>/lib/clang/19/include/arm_sve.h:271:1: error: cannot mangle this built-in __SVInt8_t type yet
  271 | __aio __attribute__((target("sve"))) svint8_t svreinterpret_s8(svint8_t op) __arm_streaming_compatible {
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  272 |   return __builtin_sve_reinterpret_s8_s8(op);
      |   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  273 | }
      | ~
<prefix>/lib/clang/19/include/arm_sve.h:125:15: note: expanded from macro '__aio'
  125 | #define __aio static __inline__ __attribute__((__always_inline__, __nodebug__, __overloadable__))
      |               ^
2 errors generated.

But that's also a separate issue that probably should be tracked separately.

llvmbot commented 2 months ago

@llvm/issue-subscribers-debuginfo

Author: Martin Storsjö (mstorsjo)

If trying to compile code that uses SVE, with CodeView debug info enabled, one easily hits this error. To reproduce: ```c #include <arm_neon_sve_bridge.h> uint64_t aom_sum_squares_2d_i16_wxh_sve() { svint64_t sum_squares = svdup_n_s64(0); return svaddv_s64(svptrue_b64(), sum_squares); } ``` ```console $ clang -target aarch64-windows-gnu -c sve-debuginfo.c -march=armv8.2-a+sve -O2 -g -gcodeview fatal error: error in backend: unknown codeview register Z0 ``` Fixing this requires MS to define how the SVE registers are to be expressed in codeview debug info. CC @pmsjt @dpaoliello (This issue was mentioned in https://github.com/llvm/llvm-project/issues/64278#issuecomment-2081507917, but splitting this out to a separate issue, as it's unrelated to the previous one.) If not compiling with `-O2`, one hits #80009 instead. But once that is implemented correctly, we still need codeview definitions for these registers. Also as a side note, if trying to build with `-target aarch64-windows-msvc`, one hits these errors instead: ``` In file included from <prefix>/lib/clang/19/include/arm_neon_sve_bridge.h:15: <prefix>/lib/clang/19/include/arm_sve.h:271:1: error: cannot mangle this built-in __SVInt8_t type yet 271 | __aio __attribute__((target("sve"))) svint8_t svreinterpret_s8(svint8_t op) __arm_streaming_compatible { | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 272 | return __builtin_sve_reinterpret_s8_s8(op); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 273 | } | ~ <prefix>/lib/clang/19/include/arm_sve.h:125:15: note: expanded from macro '__aio' 125 | #define __aio static __inline__ __attribute__((__always_inline__, __nodebug__, __overloadable__)) | ^ <prefix>/lib/clang/19/include/arm_sve.h:271:1: error: cannot mangle this built-in __SVInt8_t type yet 271 | __aio __attribute__((target("sve"))) svint8_t svreinterpret_s8(svint8_t op) __arm_streaming_compatible { | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 272 | return __builtin_sve_reinterpret_s8_s8(op); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 273 | } | ~ <prefix>/lib/clang/19/include/arm_sve.h:125:15: note: expanded from macro '__aio' 125 | #define __aio static __inline__ __attribute__((__always_inline__, __nodebug__, __overloadable__)) | ^ 2 errors generated. ``` But that's also a separate issue that probably should be tracked separately.
llvmbot commented 2 months ago

@llvm/issue-subscribers-backend-aarch64

Author: Martin Storsjö (mstorsjo)

If trying to compile code that uses SVE, with CodeView debug info enabled, one easily hits this error. To reproduce: ```c #include <arm_neon_sve_bridge.h> uint64_t aom_sum_squares_2d_i16_wxh_sve() { svint64_t sum_squares = svdup_n_s64(0); return svaddv_s64(svptrue_b64(), sum_squares); } ``` ```console $ clang -target aarch64-windows-gnu -c sve-debuginfo.c -march=armv8.2-a+sve -O2 -g -gcodeview fatal error: error in backend: unknown codeview register Z0 ``` Fixing this requires MS to define how the SVE registers are to be expressed in codeview debug info. CC @pmsjt @dpaoliello (This issue was mentioned in https://github.com/llvm/llvm-project/issues/64278#issuecomment-2081507917, but splitting this out to a separate issue, as it's unrelated to the previous one.) If not compiling with `-O2`, one hits #80009 instead. But once that is implemented correctly, we still need codeview definitions for these registers. Also as a side note, if trying to build with `-target aarch64-windows-msvc`, one hits these errors instead: ``` In file included from <prefix>/lib/clang/19/include/arm_neon_sve_bridge.h:15: <prefix>/lib/clang/19/include/arm_sve.h:271:1: error: cannot mangle this built-in __SVInt8_t type yet 271 | __aio __attribute__((target("sve"))) svint8_t svreinterpret_s8(svint8_t op) __arm_streaming_compatible { | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 272 | return __builtin_sve_reinterpret_s8_s8(op); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 273 | } | ~ <prefix>/lib/clang/19/include/arm_sve.h:125:15: note: expanded from macro '__aio' 125 | #define __aio static __inline__ __attribute__((__always_inline__, __nodebug__, __overloadable__)) | ^ <prefix>/lib/clang/19/include/arm_sve.h:271:1: error: cannot mangle this built-in __SVInt8_t type yet 271 | __aio __attribute__((target("sve"))) svint8_t svreinterpret_s8(svint8_t op) __arm_streaming_compatible { | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 272 | return __builtin_sve_reinterpret_s8_s8(op); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 273 | } | ~ <prefix>/lib/clang/19/include/arm_sve.h:125:15: note: expanded from macro '__aio' 125 | #define __aio static __inline__ __attribute__((__always_inline__, __nodebug__, __overloadable__)) | ^ 2 errors generated. ``` But that's also a separate issue that probably should be tracked separately.