From eeaaefb925a659f7bab1beea35b7c1b5f567d027 Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Sun, 13 Mar 2022 18:18:25 -0700 Subject: LLVM: fix debug info for local vars Previously we incorrectly used the pointer type as the debug info type. --- src/codegen/llvm.zig | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/codegen') diff --git a/src/codegen/llvm.zig b/src/codegen/llvm.zig index c1c7ac06f0..723516fc77 100644 --- a/src/codegen/llvm.zig +++ b/src/codegen/llvm.zig @@ -3984,13 +3984,14 @@ pub const FuncGen = struct { const pl_op = self.air.instructions.items(.data)[inst].pl_op; const operand = try self.resolveInst(pl_op.operand); const name = self.air.nullTerminatedString(pl_op.payload); + const ptr_ty = self.air.typeOf(pl_op.operand); const di_local_var = dib.createAutoVariable( self.di_scope.?, name.ptr, self.di_file.?, self.prev_dbg_line, - try self.dg.lowerDebugType(self.air.typeOf(pl_op.operand)), + try self.dg.lowerDebugType(ptr_ty.childType()), true, // always preserve 0, // flags ); -- cgit v1.2.3 From 7a477a1110c9bf7b4a83a87dcbd5b160842b29e7 Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Sun, 13 Mar 2022 22:22:19 -0700 Subject: LLVM: fix int_to_float signedness detection It was checking if the result (float) type was a signed int rather than checking the operand (integer) type. --- src/codegen/llvm.zig | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/codegen') diff --git a/src/codegen/llvm.zig b/src/codegen/llvm.zig index 723516fc77..42e94a3528 100644 --- a/src/codegen/llvm.zig +++ b/src/codegen/llvm.zig @@ -3709,10 +3709,11 @@ pub const FuncGen = struct { const ty_op = self.air.instructions.items(.data)[inst].ty_op; const operand = try self.resolveInst(ty_op.operand); + const operand_ty = self.air.typeOf(ty_op.operand); const dest_ty = self.air.typeOfIndex(inst); const dest_llvm_ty = try self.dg.llvmType(dest_ty); - if (dest_ty.isSignedInt()) { + if (operand_ty.isSignedInt()) { return self.builder.buildSIToFP(operand, dest_llvm_ty, ""); } else { return self.builder.buildUIToFP(operand, dest_llvm_ty, ""); -- cgit v1.2.3