aboutsummaryrefslogtreecommitdiff
path: root/src/codegen/llvm.zig
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2022-07-11 16:44:09 -0700
committerAndrew Kelley <andrew@ziglang.org>2022-07-12 18:38:11 -0700
commit0d164f9a25f05a2917f4e1d4eb21c85b3279b47b (patch)
treedb2bec37d9668490c09c892e9cef2d9901d82440 /src/codegen/llvm.zig
parentd789c687172166fe599d6b4cec2993f25f75989e (diff)
downloadzig-0d164f9a25f05a2917f4e1d4eb21c85b3279b47b.tar.gz
zig-0d164f9a25f05a2917f4e1d4eb21c85b3279b47b.zip
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 https://github.com/llvm/llvm-project/issues/56484) and broadened the workaround to always skip debug values for this target.
Diffstat (limited to 'src/codegen/llvm.zig')
-rw-r--r--src/codegen/llvm.zig16
1 files changed, 7 insertions, 9 deletions
diff --git a/src/codegen/llvm.zig b/src/codegen/llvm.zig
index 4275a1b69d..4333b34d98 100644
--- a/src/codegen/llvm.zig
+++ b/src/codegen/llvm.zig
@@ -5244,7 +5244,7 @@ pub const FuncGen = struct {
const operand_ty = self.air.typeOf(pl_op.operand);
const name = self.air.nullTerminatedString(pl_op.payload);
- if (needDbgVarWorkaround(self.dg, operand_ty)) {
+ if (needDbgVarWorkaround(self.dg)) {
return null;
}
@@ -6988,7 +6988,7 @@ pub const FuncGen = struct {
const inst_ty = self.air.typeOfIndex(inst);
if (self.dg.object.di_builder) |dib| {
- if (needDbgVarWorkaround(self.dg, inst_ty)) {
+ if (needDbgVarWorkaround(self.dg)) {
return arg_val;
}
@@ -9255,13 +9255,11 @@ const AnnotatedDITypePtr = enum(usize) {
const lt_errors_fn_name = "__zig_lt_errors_len";
/// Without this workaround, LLVM crashes with "unknown codeview register H1"
-/// TODO use llvm-reduce and file upstream LLVM bug for this.
-fn needDbgVarWorkaround(dg: *DeclGen, ty: Type) bool {
- if (ty.tag() == .f16) {
- const target = dg.module.getTarget();
- if (target.os.tag == .windows and target.cpu.arch == .aarch64) {
- return true;
- }
+/// https://github.com/llvm/llvm-project/issues/56484
+fn needDbgVarWorkaround(dg: *DeclGen) bool {
+ const target = dg.module.getTarget();
+ if (target.os.tag == .windows and target.cpu.arch == .aarch64) {
+ return true;
}
return false;
}