File tree Expand file tree Collapse file tree 2 files changed +11
-4
lines changed 
crates/rustc_codegen_spirv/src Expand file tree Collapse file tree 2 files changed +11
-4
lines changed Original file line number Diff line number Diff line change @@ -309,10 +309,17 @@ impl ThinBufferMethods for SpirvModuleBuffer {
309309impl  SpirvCodegenBackend  { 
310310    fn  optimize_common ( 
311311        _cgcx :  & CodegenContext < Self > , 
312-         _module :  & mut  ModuleCodegen < <Self  as  WriteBackendMethods >:: Module > , 
312+         module :  & mut  ModuleCodegen < <Self  as  WriteBackendMethods >:: Module > , 
313313    )  -> Result < ( ) ,  FatalError >  { 
314-         // FIXME(eddyb) actually run as many optimization passes as possible, 
315-         // before ever serializing `.spv` files that will later get linked. 
314+         // Apply DCE ("dead code elimination") to modules before ever serializing 
315+         // them as `.spv` files (technically, `.rcgu.o` files inside `.rlib`s), 
316+         // that will later get linked (potentially many times, esp. if this is 
317+         // some big upstream library, e.g. `core` itself), and will therefore 
318+         // benefit from not having to clean up all sorts of unreachable helpers. 
319+         linker:: dce:: dce ( & mut  module. module_llvm ) ; 
320+ 
321+         // FIXME(eddyb) run as many optimization passes as possible, not just DCE. 
322+ 
316323        Ok ( ( ) ) 
317324    } 
318325} 
Original file line number Diff line number Diff line change 11#[ cfg( test) ]  
22mod  test; 
33
4- mod  dce; 
4+ pub ( crate )   mod  dce; 
55mod  destructure_composites; 
66mod  duplicates; 
77mod  entry_interface; 
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments