Skip to content

Commit 2086550

Browse files
committed
LLVM: broaden aarch64-windows f16 debug variable workaround
LLVM does not properly handle debug info for f16 on the aarch64-windows target, causing "fatal error: unknown codeview register H1". The previous workaround checked only for f16 but was still vulnerable if a type was a byval struct or tuple which had an f16 field in it. Now I have filed an upstream issue (see llvm/llvm-project#56484) and broadened the workaround to always skip debug values for this target.
1 parent 5d88579 commit 2086550

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

src/codegen/llvm.zig

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5244,7 +5244,7 @@ pub const FuncGen = struct {
52445244
const operand_ty = self.air.typeOf(pl_op.operand);
52455245
const name = self.air.nullTerminatedString(pl_op.payload);
52465246

5247-
if (needDbgVarWorkaround(self.dg, operand_ty)) {
5247+
if (needDbgVarWorkaround(self.dg)) {
52485248
return null;
52495249
}
52505250

@@ -6988,7 +6988,7 @@ pub const FuncGen = struct {
69886988

69896989
const inst_ty = self.air.typeOfIndex(inst);
69906990
if (self.dg.object.di_builder) |dib| {
6991-
if (needDbgVarWorkaround(self.dg, inst_ty)) {
6991+
if (needDbgVarWorkaround(self.dg)) {
69926992
return arg_val;
69936993
}
69946994

@@ -9255,13 +9255,11 @@ const AnnotatedDITypePtr = enum(usize) {
92559255
const lt_errors_fn_name = "__zig_lt_errors_len";
92569256

92579257
/// Without this workaround, LLVM crashes with "unknown codeview register H1"
9258-
/// TODO use llvm-reduce and file upstream LLVM bug for this.
9259-
fn needDbgVarWorkaround(dg: *DeclGen, ty: Type) bool {
9260-
if (ty.tag() == .f16) {
9261-
const target = dg.module.getTarget();
9262-
if (target.os.tag == .windows and target.cpu.arch == .aarch64) {
9263-
return true;
9264-
}
9258+
/// https://github.com/llvm/llvm-project/issues/56484
9259+
fn needDbgVarWorkaround(dg: *DeclGen) bool {
9260+
const target = dg.module.getTarget();
9261+
if (target.os.tag == .windows and target.cpu.arch == .aarch64) {
9262+
return true;
92659263
}
92669264
return false;
92679265
}

0 commit comments

Comments
 (0)