Auto merge of #96549 - ouz-a:mir-opt, r=oli-obk
Move Derefer before Retag _Follow up work to #96116 #95857 #95649_ This moves `Derefer` before `Retag` and creates a new `LocalInfo` called `Temp` to avoid retagging created temp values. Zulip discussion [link](https://rust-lang.zulipchat.com/#narrow/stream/189540-t-compiler.2Fwg-mir-opt/topic/deref.20as.20first.20and.20only.20projection) r? `@oli-obk`
This commit is contained in:
commit
6eda7642bd
35 changed files with 69 additions and 148 deletions
|
@ -1087,6 +1087,8 @@ pub enum LocalInfo<'tcx> {
|
|||
/// A temporary created during the creation of an aggregate
|
||||
/// (e.g. a temporary for `foo` in `MyStruct { my_field: foo }`)
|
||||
AggregateTemp,
|
||||
/// A temporary created during the pass `Derefer` to avoid it's retagging
|
||||
DerefTemp,
|
||||
}
|
||||
|
||||
impl<'tcx> LocalDecl<'tcx> {
|
||||
|
|
|
@ -78,13 +78,24 @@ impl<'tcx> MirPatch<'tcx> {
|
|||
Location { block: bb, statement_index: offset }
|
||||
}
|
||||
|
||||
pub fn new_temp(&mut self, ty: Ty<'tcx>, span: Span) -> Local {
|
||||
pub fn new_local_with_info(
|
||||
&mut self,
|
||||
ty: Ty<'tcx>,
|
||||
span: Span,
|
||||
local_info: Option<Box<LocalInfo<'tcx>>>,
|
||||
) -> Local {
|
||||
let index = self.next_local;
|
||||
self.next_local += 1;
|
||||
self.new_locals.push(LocalDecl::new(ty, span));
|
||||
let mut new_decl = LocalDecl::new(ty, span);
|
||||
new_decl.local_info = local_info;
|
||||
self.new_locals.push(new_decl);
|
||||
Local::new(index as usize)
|
||||
}
|
||||
|
||||
pub fn new_temp(&mut self, ty: Ty<'tcx>, span: Span) -> Local {
|
||||
self.new_local_with_info(ty, span, None)
|
||||
}
|
||||
|
||||
pub fn new_internal(&mut self, ty: Ty<'tcx>, span: Span) -> Local {
|
||||
let index = self.next_local;
|
||||
self.next_local += 1;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue