Skip to content

Commit 9201e70

Browse files
committed
Adjust autodiff actitivies for ScalarPair
1 parent ac712da commit 9201e70

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

compiler/rustc_codegen_llvm/src/builder/autodiff.rs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,23 @@ pub(crate) fn adjust_activity_to_abi<'tcx>(
8080
continue;
8181
}
8282
}
83+
84+
let pci = PseudoCanonicalInput { typing_env: TypingEnv::fully_monomorphized(), value: *ty };
85+
86+
let layout = match tcx.layout_of(pci) {
87+
Ok(layout) => layout.layout,
88+
Err(_) => {
89+
bug!("failed to compute layout for type {:?}", ty);
90+
}
91+
};
92+
93+
match layout.backend_repr() {
94+
rustc_abi::BackendRepr::ScalarPair(_, _) => {
95+
new_activities.push(da[i].clone());
96+
new_positions.push(i + 1);
97+
}
98+
_ => {}
99+
}
83100
}
84101
// now add the extra activities coming from slices
85102
// Reverse order to not invalidate the indices

0 commit comments

Comments
 (0)