@@ -157,10 +157,10 @@ use rustc_middle::dep_graph::{WorkProduct, WorkProductId};
157157use rustc_middle:: mir:: mono:: { MonoItem , MonoItemData } ;
158158use rustc_middle:: mir:: pretty:: write_mir_pretty;
159159use rustc_middle:: ty:: print:: with_no_trimmed_paths;
160- use rustc_middle:: ty:: { self , Instance , InstanceKind , TyCtxt } ;
160+ use rustc_middle:: ty:: { InstanceKind , TyCtxt } ;
161161use rustc_session:: Session ;
162162use rustc_session:: config:: { self , OutputFilenames , OutputType } ;
163- use rustc_span:: symbol:: { Symbol , sym } ;
163+ use rustc_span:: symbol:: Symbol ;
164164use std:: any:: Any ;
165165use std:: fs:: { File , create_dir_all} ;
166166use std:: io:: Cursor ;
@@ -184,45 +184,6 @@ fn dump_mir(tcx: TyCtxt<'_>, mono_items: &[(MonoItem<'_>, MonoItemData)], path:
184184 }
185185}
186186
187- fn is_blocklisted_fn < ' tcx > (
188- tcx : TyCtxt < ' tcx > ,
189- sym : & symbols:: Symbols ,
190- instance : Instance < ' tcx > ,
191- ) -> bool {
192- // TODO: These sometimes have a constant value of an enum variant with a hole
193- if let InstanceKind :: Item ( def_id) = instance. def {
194- if let Some ( debug_trait_def_id) = tcx. get_diagnostic_item ( sym:: Debug ) {
195- // Helper for detecting `<_ as core::fmt::Debug>::fmt` (in impls).
196- let is_debug_fmt_method = |def_id| match tcx. opt_associated_item ( def_id) {
197- Some ( assoc) if assoc. ident ( tcx) . name == sym:: fmt => match assoc. container {
198- ty:: AssocItemContainer :: Impl => {
199- let impl_def_id = assoc. container_id ( tcx) ;
200- tcx. impl_trait_ref ( impl_def_id)
201- . map ( |tr| tr. skip_binder ( ) . def_id )
202- == Some ( debug_trait_def_id)
203- }
204- ty:: AssocItemContainer :: Trait => false ,
205- } ,
206- _ => false ,
207- } ;
208-
209- if is_debug_fmt_method ( def_id) {
210- return true ;
211- }
212-
213- if tcx. opt_item_ident ( def_id) . map ( |i| i. name ) == Some ( sym. fmt_decimal ) {
214- if let Some ( parent_def_id) = tcx. opt_parent ( def_id) {
215- if is_debug_fmt_method ( parent_def_id) {
216- return true ;
217- }
218- }
219- }
220- }
221- }
222-
223- false
224- }
225-
226187// TODO: Should this store Vec or Module?
227188struct SpirvModuleBuffer ( Vec < u32 > ) ;
228189
@@ -470,11 +431,6 @@ impl ExtraBackendMethods for SpirvCodegenBackend {
470431 }
471432
472433 for & ( mono_item, mono_item_data) in mono_items. iter ( ) {
473- if let MonoItem :: Fn ( instance) = mono_item {
474- if is_blocklisted_fn ( cx. tcx , & cx. sym , instance) {
475- continue ;
476- }
477- }
478434 mono_item. predefine :: < Builder < ' _ , ' _ > > (
479435 & cx,
480436 mono_item_data. linkage ,
@@ -484,11 +440,6 @@ impl ExtraBackendMethods for SpirvCodegenBackend {
484440
485441 // ... and now that we have everything pre-defined, fill out those definitions.
486442 for & ( mono_item, _) in mono_items. iter ( ) {
487- if let MonoItem :: Fn ( instance) = mono_item {
488- if is_blocklisted_fn ( cx. tcx , & cx. sym , instance) {
489- continue ;
490- }
491- }
492443 mono_item. define :: < Builder < ' _ , ' _ > > ( & cx) ;
493444 }
494445
0 commit comments