@@ -13,7 +13,7 @@ use rustc_codegen_ssa::traits::*;
1313use rustc_data_structures:: fx:: FxHashMap ;
1414use rustc_hir as hir;
1515use rustc_middle:: ty:: layout:: TyAndLayout ;
16- use rustc_middle:: { bug, span_bug} ;
16+ use rustc_middle:: { bug, span_bug, ty :: Instance } ;
1717use rustc_span:: { Pos , Span , Symbol } ;
1818use rustc_target:: abi:: * ;
1919use rustc_target:: asm:: * ;
@@ -120,6 +120,7 @@ impl AsmBuilderMethods<'tcx> for Builder<'a, 'll, 'tcx> {
120120 operands : & [ InlineAsmOperandRef < ' tcx , Self > ] ,
121121 options : InlineAsmOptions ,
122122 line_spans : & [ Span ] ,
123+ instance : Instance < ' _ > ,
123124 ) {
124125 let asm_arch = self . tcx . sess . asm_arch . unwrap ( ) ;
125126
@@ -135,7 +136,10 @@ impl AsmBuilderMethods<'tcx> for Builder<'a, 'll, 'tcx> {
135136 let is_target_supported = |reg_class : InlineAsmRegClass | {
136137 for & ( _, feature) in reg_class. supported_types ( asm_arch) {
137138 if let Some ( feature) = feature {
138- if self . tcx . sess . target_features . contains ( & Symbol :: intern ( feature) )
139+ let codegen_fn_attrs = self . tcx . codegen_fn_attrs ( instance. def_id ( ) ) ;
140+ let feature_name = Symbol :: intern ( feature) ;
141+ if self . tcx . sess . target_features . contains ( & feature_name)
142+ || codegen_fn_attrs. target_features . contains ( & feature_name)
139143 {
140144 return true ;
141145 }
0 commit comments