rust/compiler/rustc_codegen_llvm/src
bors 8b6b15b877 Auto merge of #142771 - dianqk:mir-stmt-debuginfo, r=cjgillot
Introduce debuginfo to statements in MIR

The PR introduces support for debug information within dead statements. Currently, only the reference statement is supported, which is sufficient to fix rust-lang/rust#128081.

I don't modify Stable MIR, as I don't think we need debug information when using it.

This PR represents the debug information for the dead reference statement via `#dbg_value`. For example, `let _foo_b = &foo.b` becomes `#dbg_value(ptr %foo, !22, !DIExpression(DW_OP_plus_uconst, 4, DW_OP_stack_value), !26)`. You can see this here: https://rust.godbolt.org/z/d43js6adv.

The general principle for handling debug information is to never provide less debug information than the optimized LLVM IR.

The current rules for dropping debug information in this PR are:

- If the LLVM IR cannot represent a reference address, it's replaced with poison or simply dropped. For example, see: https://rust.godbolt.org/z/shGqPec8W. I'm using poison in all such cases now.
- All debuginfos is dropped when merging multiple successor BBs. An example is available here: https://rust.godbolt.org/z/TE1q3Wq6M.

I doesn't drop debuginfos in `MatchBranchSimplification`, because LLVM also pick one branch for it.
2025-10-03 11:49:42 +00:00
..
back Rollup merge of #144197 - KMJ-007:type-tree, r=ZuseZ4 2025-09-28 18:13:11 +02:00
builder fix void and empty struct ret 2025-09-30 22:47:40 -04:00
coverageinfo Mark some coverage-related bindings as safe 2025-09-16 22:00:10 +10:00
debuginfo Auto merge of #142771 - dianqk:mir-stmt-debuginfo, r=cjgillot 2025-10-03 11:49:42 +00:00
llvm codegen: Generate dbg_value for the ref statement 2025-10-02 14:55:51 +08:00
abi.rs Rollup merge of #144197 - KMJ-007:type-tree, r=ZuseZ4 2025-09-28 18:13:11 +02:00
allocator.rs Emit allocator attributes for allocator shim 2025-09-29 11:29:59 +02:00
asm.rs Extract helper method set_metadata_node 2025-10-02 18:04:23 +10:00
attributes.rs Use standard attribute logic for allocator shim 2025-09-25 10:04:40 +02:00
base.rs Use standard attribute logic for allocator shim 2025-09-25 10:04:40 +02:00
builder.rs Extract helper method set_metadata_node 2025-10-02 18:04:23 +10:00
callee.rs remove rustc_attr_data_structures 2025-07-31 14:19:27 +02:00
common.rs initial implementation of the darwin_objc unstable feature 2025-09-13 16:06:22 -07:00
consts.rs Extract helper method module_add_named_metadata_node 2025-10-02 18:04:24 +10:00
context.rs Extract helper method global_set_metadata_node 2025-10-02 18:06:58 +10:00
declare.rs Use standard attribute logic for allocator shim 2025-09-25 10:04:40 +02:00
errors.rs Use the object crate rather than LLVM for extracting bitcode sections 2025-07-25 11:21:28 +00:00
intrinsic.rs Rollup merge of #147134 - workingjubilee:remove-explicit-abialign-deref, r=Zalathar 2025-09-29 15:44:55 +10:00
lib.rs Rollup merge of #147127 - antoyo:fix/gcc-linker-plugin, r=bjorn3 2025-09-29 11:56:44 +10:00
llvm_util.rs Add panic=immediate-abort 2025-09-21 13:12:18 -04:00
mono_item.rs Replace the llvm::Bool typedef with a proper newtype 2025-08-24 23:09:54 +10:00
type_.rs Extract helper method global_set_metadata_node 2025-10-02 18:06:58 +10:00
type_of.rs Auto merge of #145717 - BoxyUwU:erase_regions_rename, r=lcnr 2025-09-09 15:04:44 +00:00
typetree.rs autodiff: typetree recursive depth query from enzyme with fallback 2025-09-19 05:42:27 +00:00
va_arg.rs Rollup merge of #147134 - workingjubilee:remove-explicit-abialign-deref, r=Zalathar 2025-09-29 15:44:55 +10:00
value.rs Add warn(unreachable_pub) to rustc_codegen_llvm. 2024-08-16 08:46:57 +10:00