Auto merge of #107851 - cjgillot:sroa-const, r=oli-obk
Put deaggregated statements after original constant. Fixes https://github.com/rust-lang/rust/issues/107818
This commit is contained in:
commit
585f3eef26
3 changed files with 57 additions and 0 deletions
|
@ -318,6 +318,8 @@ impl<'tcx, 'll> MutVisitor<'tcx> for ReplacementVisitor<'tcx, 'll> {
|
|||
// ConstProp will pick up the pieces and replace them by actual constants.
|
||||
StatementKind::Assign(box (place, Rvalue::Use(Operand::Constant(_)))) => {
|
||||
if let Some(final_locals) = self.replacements.place_fragments(place) {
|
||||
// Put the deaggregated statements *after* the original one.
|
||||
let location = location.successor_within_block();
|
||||
for (field, ty, new_local) in final_locals {
|
||||
let rplace = self.tcx.mk_place_field(place, field, ty);
|
||||
let rvalue = Rvalue::Use(Operand::Move(rplace));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue