diff options
| author | Wesley Wiser <wwiser@gmail.com> | 2020-05-30 15:02:32 -0400 |
|---|---|---|
| committer | Wesley Wiser <wwiser@gmail.com> | 2020-12-06 20:48:25 -0500 |
| commit | 01aec8d18556be5e8d498c2f331b9015b7befde2 (patch) | |
| tree | 319bf10bc8a93fda56f200deedadf76c7a534b8e /compiler/rustc_codegen_llvm/src | |
| parent | b776d1c3e3db8befabb123ebb1e46c3531eaed46 (diff) | |
| download | rust-01aec8d18556be5e8d498c2f331b9015b7befde2.tar.gz rust-01aec8d18556be5e8d498c2f331b9015b7befde2.zip | |
[mir-opt] Allow debuginfo to be generated for a constant or a Place
Prior to this commit, debuginfo was always generated by mapping a name to a Place. This has the side-effect that `SimplifyLocals` cannot remove locals that are only used for debuginfo because their other uses have been const-propagated. To allow these locals to be removed, we now allow debuginfo to point to a constant value. The `ConstProp` pass detects when debuginfo points to a local with a known constant value and replaces it with the value. This allows the later `SimplifyLocals` pass to remove the local.
Diffstat (limited to 'compiler/rustc_codegen_llvm/src')
| -rw-r--r-- | compiler/rustc_codegen_llvm/src/debuginfo/metadata.rs | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/compiler/rustc_codegen_llvm/src/debuginfo/metadata.rs b/compiler/rustc_codegen_llvm/src/debuginfo/metadata.rs index 96484034da7..31e43893ac8 100644 --- a/compiler/rustc_codegen_llvm/src/debuginfo/metadata.rs +++ b/compiler/rustc_codegen_llvm/src/debuginfo/metadata.rs @@ -1409,10 +1409,11 @@ fn generator_layout_and_saved_local_names( let state_arg = mir::Local::new(1); for var in &body.var_debug_info { - if var.place.local != state_arg { + let place = if let mir::VarDebugInfoContents::Place(p) = var.value { p } else { continue }; + if place.local != state_arg { continue; } - match var.place.projection[..] { + match place.projection[..] { [ // Deref of the `Pin<&mut Self>` state argument. mir::ProjectionElem::Field(..), |
