Use unstable_target_features when checking inline assembly

This is necessary to properly validate register classes even when the
relevant target feature name is still unstable.
This commit is contained in:
Amanieu d'Antras 2023-08-04 16:09:54 +01:00
parent da6b55cc5e
commit a3ab31c0f9
2 changed files with 6 additions and 5 deletions

View file

@ -44,9 +44,10 @@ impl<'ll, 'tcx> AsmBuilderMethods<'tcx> for Builder<'_, 'll, 'tcx> {
let is_target_supported = |reg_class: InlineAsmRegClass| {
for &(_, feature) in reg_class.supported_types(asm_arch) {
if let Some(feature) = feature {
let codegen_fn_attrs = self.tcx.codegen_fn_attrs(instance.def_id());
if self.tcx.sess.target_features.contains(&feature)
|| codegen_fn_attrs.target_features.contains(&feature)
if self
.tcx
.asm_target_features(instance.def_id())
.contains(&feature)
{
return true;
}