Skip to content

Commit d8c09d3

Browse files
committed
Adjust autodiff actitivies for ScalarPair
1 parent 6420b0b commit d8c09d3

File tree

1 file changed

+17
-0
lines changed
  • compiler/rustc_monomorphize/src/partitioning

1 file changed

+17
-0
lines changed

compiler/rustc_monomorphize/src/partitioning/autodiff.rs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,23 @@ fn adjust_activity_to_abi<'tcx>(tcx: TyCtxt<'tcx>, fn_ty: Ty<'tcx>, da: &mut Vec
7070
continue;
7171
}
7272
}
73+
74+
let pci = PseudoCanonicalInput { typing_env: TypingEnv::fully_monomorphized(), value: *ty };
75+
76+
let layout = match tcx.layout_of(pci) {
77+
Ok(layout) => layout.layout,
78+
Err(_) => {
79+
bug!("failed to compute layout for type {:?}", ty);
80+
}
81+
};
82+
83+
match layout.backend_repr() {
84+
rustc_abi::BackendRepr::ScalarPair(_, _) => {
85+
new_activities.push(da[i].clone());
86+
new_positions.push(i + 1);
87+
}
88+
_ => {}
89+
}
7390
}
7491
// now add the extra activities coming from slices
7592
// Reverse order to not invalidate the indices

0 commit comments

Comments
 (0)