-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
A-codegenArea: Code generationArea: Code generationC-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.E-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Description
That is, if -Zfewer-names
is false
(usually only because of --emit=llvm-ir
), we should use the same name for LLVM globals we generate out of miri allocs as #67133 does in MIR output (allocN
).
This way, we can easily see the mapping between MIR and LLVM IR (and it shouldn't be any costlier for regular compilation, which would continue to use unnamed globals).
Relevant code (btw this could probably use extra caching keyed on AllocId
?):
rust/src/librustc_codegen_llvm/common.rs
Lines 260 to 267 in be493fe
Some(GlobalAlloc::Memory(alloc)) => { | |
let init = const_alloc_to_llvm(self, alloc); | |
if alloc.mutability == Mutability::Mut { | |
self.static_addr_of_mut(init, alloc.align, None) | |
} else { | |
self.static_addr_of(init, alloc.align, None) | |
} | |
} |
cc @rust-lang/wg-mir-opt @bjorn3
This issue has been assigned to @chrissimpkins via this comment.
oli-obk and RalfJung
Metadata
Metadata
Assignees
Labels
A-codegenArea: Code generationArea: Code generationC-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.E-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.