authorgravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2024-08-13 05:26:30+02:00
committergravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2024-08-15 10:56:33+02:00
log7a8e86e46ceb1350509b4296c2a45af45100df41
treec28f6eb1bdc590e3aaaeb01c3d5bce7b67b92206
parentacad2fae4463d0f3df873b5c377c252954639116
signaturebadge-check Signed by SSH key SHA256:7B/LJ7bpR1eX8aCXSr4mtd5M45VMPKcx9zY8e95b5QM

llvm: Don't emit extra debug instructions for `dbg_var_val` in naked functions.


1 files changed, 4 insertions(+), 1 deletions(-)

src/codegen/llvm.zig+4-1
......@@ -6743,7 +6743,10 @@ pub const FuncGen = struct {
67436743 },
67446744 "",
67456745 );
6746 } else if (owner_mod.optimize_mode == .Debug) {
6746 } else if (owner_mod.optimize_mode == .Debug and !self.is_naked) {
6747 // We avoid taking this path for naked functions because there's no guarantee that such
6748 // functions even have a valid stack pointer, making the `alloca` + `store` unsafe.
6749
67476750 const alignment = operand_ty.abiAlignment(pt).toLlvm();
67486751 const alloca = try self.buildAlloca(operand.typeOfWip(&self.wip), alignment);
67496752 _ = try self.wip.store(.normal, operand, alloca, alignment);