rust/compiler/rustc_codegen_ssa/src
bors bc888958c9 Auto merge of #111440 - cjgillot:refprop-debuginfo, r=oli-obk
Allow MIR debuginfo to point to a variable's address

MIR optimizations currently do not to operate on borrowed locals.

When enabling #106285, many borrows will be left as-is because they are used in debuginfo. This pass allows to replace this pattern directly in MIR debuginfo:
```rust
a => _1
_1 = &raw? mut? _2
```
becomes
```rust
a => &_2
// No statement to borrow _2.
```

This pass is implemented as a drive-by in ReferencePropagation MIR pass.

This transformation allows following following MIR opts to treat _2 as an unborrowed local, and optimize it as such, even in builds with debuginfo.

In codegen, when encountering `a => &..&_2`, we create a list of allocas:
```llvm
store ptr %_2.dbg.spill, ptr %a.ref0.dbg.spill
store ptr %a.ref0.dbg.spill, ptr %a.ref1.dbg.spill
...
call void `@llvm.dbg.declare(metadata` ptr %a.ref{n}.dbg.spill, /* ... */)
```

Caveat: this transformation looses the exact type, we do not differentiate `a` as a immutable, mutable reference or a raw pointer. Everything is declared to `*mut` to codegen. I'm not convinced this is a blocker.
2023-05-14 05:31:10 +00:00
..
back Auto merge of #106560 - bjorn3:support_staticlib_dylib_linking, r=pnkfelix 2023-05-10 03:40:40 +00:00
coverageinfo Isolate coverage FFI type layouts from their underlying LLVM C++ types 2023-05-09 18:08:32 +10:00
debuginfo Restrict From<S> for {D,Subd}iagnosticMessage. 2023-05-03 08:44:39 +10:00
mir Auto merge of #111440 - cjgillot:refprop-debuginfo, r=oli-obk 2023-05-14 05:31:10 +00:00
traits Auto merge of #107586 - SparrowLii:parallel-query, r=cjgillot 2023-05-13 13:47:53 +00:00
base.rs introduce DynSend and DynSync auto trait 2023-05-06 09:34:18 +08:00
codegen_attrs.rs Rollup merge of #109677 - dpaoliello:rawdylib, r=michaelwoerister,wesleywiser 2023-05-06 09:09:30 +09:00
common.rs DELETE - fn span_invalid_monomorphization_error and localize intrinsics macros 2022-12-27 20:59:22 -05:00
errors.rs Fix static string lints 2023-04-25 18:59:55 +01:00
glue.rs Use size_of_val instead of manual calculation 2023-03-17 19:55:49 -07:00
lib.rs Change rlink serialization from MemEncoder to FileEncoder. 2023-05-01 17:09:59 +10:00
meth.rs Add cross-language LLVM CFI support to the Rust compiler 2023-05-03 22:41:29 +00:00
mono_item.rs Store a LocalDefId in hir::AnonConst. 2022-11-13 14:06:11 +00:00
target_features.rs Restrict From<S> for {D,Subd}iagnosticMessage. 2023-05-03 08:44:39 +10:00