Refactor call terminator to always hold a destination place

This commit is contained in:
Jakob Degen 2022-04-16 09:27:54 -04:00
parent 222c5724ec
commit 09b0936db2
67 changed files with 422 additions and 412 deletions

View file

@ -141,7 +141,7 @@ impl<'tcx> InstCombineContext<'tcx, '_> {
terminator: &mut Terminator<'tcx>,
statements: &mut Vec<Statement<'tcx>>,
) {
let TerminatorKind::Call { func, args, destination, .. } = &mut terminator.kind
let TerminatorKind::Call { func, args, destination, target, .. } = &mut terminator.kind
else { return };
// It's definitely not a clone if there are multiple arguments
@ -149,7 +149,7 @@ impl<'tcx> InstCombineContext<'tcx, '_> {
return;
}
let Some((destination_place, destination_block)) = *destination
let Some(destination_block) = *target
else { return };
// Only bother looking more if it's easy to know what we're calling
@ -193,7 +193,7 @@ impl<'tcx> InstCombineContext<'tcx, '_> {
statements.push(Statement {
source_info: terminator.source_info,
kind: StatementKind::Assign(Box::new((
destination_place,
*destination,
Rvalue::Use(Operand::Copy(
arg_place.project_deeper(&[ProjectionElem::Deref], self.tcx),
)),