rust/compiler/rustc_codegen_llvm/src
bors 5e842953cc Auto merge of #130052 - khuey:clear-dilocation-after-const-emission, r=michaelwoerister
Don't leave debug locations for constants sitting on the builder indefinitely

Because constants are currently emitted *before* the prologue, leaving the debug location on the IRBuilder spills onto other instructions in the prologue and messes up both line numbers as well as the point LLVM chooses to be the prologue end.

Example LLVM IR (irrelevant IR elided):
Before:
```
define internal { i64, i64 } `@_ZN3tmp3Foo18var_return_opt_try17he02116165b0fc08cE(ptr` align 8 %self) !dbg !347 { start:
  %self.dbg.spill = alloca [8 x i8], align 8
  %_0 = alloca [16 x i8], align 8
  %residual.dbg.spill = alloca [0 x i8], align 1
    #dbg_declare(ptr %residual.dbg.spill, !353, !DIExpression(), !357)
  store ptr %self, ptr %self.dbg.spill, align 8, !dbg !357
    #dbg_declare(ptr %self.dbg.spill, !350, !DIExpression(), !358)
```
After:
```
define internal { i64, i64 } `@_ZN3tmp3Foo18var_return_opt_try17h00b17d08874ddd90E(ptr` align 8 %self) !dbg !347 { start:
  %self.dbg.spill = alloca [8 x i8], align 8
  %_0 = alloca [16 x i8], align 8
  %residual.dbg.spill = alloca [0 x i8], align 1
    #dbg_declare(ptr %residual.dbg.spill, !353, !DIExpression(), !357)
  store ptr %self, ptr %self.dbg.spill, align 8
    #dbg_declare(ptr %self.dbg.spill, !350, !DIExpression(), !358)
```
Note in particular how !357 from %residual.dbg.spill's dbg_declare no longer falls through onto the store to %self.dbg.spill. This fixes argument values at entry when the constant is a ZST (e.g. `<Option as Try>::Residual`). This fixes #130003 (but note that it does *not* fix issues with argument values and non-ZST constants, which emit their own stores that have debug info on them, like #128945).

r? `@michaelwoerister`
2024-09-13 08:57:41 +00:00
..
back Simplify some nested if statements 2024-09-11 13:45:23 -04:00
coverageinfo chore: Fix typos in 'compiler' (batch 1) 2024-09-02 07:42:38 +02:00
debuginfo Don't leave debug locations for constants sitting on the builder indefinitely. 2024-09-06 23:12:18 +00:00
llvm Don't leave debug locations for constants sitting on the builder indefinitely. 2024-09-06 23:12:18 +00:00
abi.rs Add warn(unreachable_pub) to rustc_codegen_llvm. 2024-08-16 08:46:57 +10:00
allocator.rs Avoid extra cast()s after CStr::as_ptr() 2024-08-20 14:04:48 -07:00
asm.rs Add f16 and f128 inline ASM support for aarch64 2024-08-25 00:13:25 +01:00
attributes.rs Do not request sanitizers for naked functions 2024-09-06 14:11:13 +02:00
base.rs Add warn(unreachable_pub) to rustc_codegen_llvm. 2024-08-16 08:46:57 +10:00
builder.rs Add warn(unreachable_pub) to rustc_codegen_llvm. 2024-08-16 08:46:57 +10:00
callee.rs Add warn(unreachable_pub) to rustc_codegen_llvm. 2024-08-16 08:46:57 +10:00
common.rs Add warn(unreachable_pub) to rustc_codegen_llvm. 2024-08-16 08:46:57 +10:00
consts.rs Rollup merge of #128820 - LYF1999:yf/dev, r=nikic 2024-09-05 18:58:53 +02:00
context.rs Add -Z small-data-threshold 2024-09-10 12:19:16 -07:00
declare.rs Add warn(unreachable_pub) to rustc_codegen_llvm. 2024-08-16 08:46:57 +10:00
errors.rs Rollup merge of #126013 - nnethercote:unreachable_pub, r=Urgau 2024-08-27 00:41:57 +02:00
intrinsic.rs Don't codegen expect in opt-level=0 2024-09-04 11:49:00 +00:00
lib.rs update cfgs 2024-09-05 17:24:01 +01:00
llvm_util.rs Auto merge of #117465 - paulmenage:small-data-limit, r=compiler-errors 2024-09-12 04:27:08 +00:00
mono_item.rs codegen: better centralize function attribute computation 2024-08-07 19:49:48 +02:00
type_.rs Add warn(unreachable_pub) to rustc_codegen_llvm. 2024-08-16 08:46:57 +10:00
type_of.rs Add warn(unreachable_pub) to rustc_codegen_llvm. 2024-08-16 08:46:57 +10:00
va_arg.rs Reformat use declarations. 2024-07-29 08:26:52 +10:00
value.rs Add warn(unreachable_pub) to rustc_codegen_llvm. 2024-08-16 08:46:57 +10:00