rust/compiler/rustc_codegen_gcc/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 Remove serialized_bitcode from LtoModuleCodegen. 2024-09-09 09:00:50 +10:00
intrinsic simd_shuffle intrinsic: allow argument to be passed as vector (not just as array) 2024-08-13 07:51:17 +02:00
abi.rs Format cg_gcc with same formatting parameters 2024-07-17 20:22:07 +02:00
allocator.rs Merge commit 'b385428e3d' into subtree-update_cg_gcc_2024-03-05 2024-03-05 19:58:36 +01:00
archive.rs Move computation of decorated names out of the create_dll_import_lib method 2024-07-30 10:32:32 +00:00
asm.rs Reformat use declarations. 2024-07-29 08:26:52 +10:00
attributes.rs Hide implicit target features from diagnostics when possible 2024-08-07 00:43:52 -04:00
base.rs Reformat use declarations. 2024-07-29 08:26:52 +10:00
builder.rs make the GCC backend compatible with vector shuffle indices 2024-08-13 07:51:28 +02:00
callee.rs Merge commit '98ed962c7d' into master 2024-07-10 12:44:23 +02:00
common.rs const vector passed to codegen 2024-08-08 11:15:03 +01:00
consts.rs Reformat use declarations. 2024-07-29 08:26:52 +10:00
context.rs Reformat use declarations. 2024-07-29 08:26:52 +10:00
coverageinfo.rs Unbox and unwrap the contents of StatementKind::Coverage 2024-03-23 22:05:11 +11:00
debuginfo.rs Don't leave debug locations for constants sitting on the builder indefinitely. 2024-09-06 23:12:18 +00:00
declare.rs Merge commit '98ed962c7d' into master 2024-07-10 12:44:23 +02:00
errors.rs Remove redundant argument from subdiagnostic method 2024-06-18 15:42:11 +00:00
gcc_util.rs Refactor and fill out target feature lists 2024-08-07 00:41:48 -04:00
int.rs Reformat use declarations. 2024-07-29 08:26:52 +10:00
lib.rs Use sysroot crates maximally in rustc_codegen_gcc. 2024-09-02 15:35:58 +10:00
mono_item.rs Reformat use declarations. 2024-07-29 08:26:52 +10:00
type_.rs Merge commit '98ed962c7d' into master 2024-07-10 12:44:23 +02:00
type_of.rs Shrink TyKind::FnPtr. 2024-08-09 14:33:25 +10:00