File tree Expand file tree Collapse file tree 2 files changed +11
-11
lines changed
crates/rustc_codegen_spirv/src Expand file tree Collapse file tree 2 files changed +11
-11
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;
@@ -277,13 +277,6 @@ pub fn link(
277277 output
278278 } ;
279279
280- // FIXME(eddyb) do this before ever saving the original `.spv`s to disk.
281- {
282- let _timer = sess. timer ( "link_dce-post-merge" ) ;
283- dce:: dce ( & mut output) ;
284- }
285-
286- // HACK(eddyb) this has to be after DCE, to not break SPIR-T w/ dead decorations.
287280 if let Some ( dir) = & opts. dump_post_merge {
288281 dump_spv_and_spirt ( & output, dir. join ( disambiguated_crate_name_for_dumps) ) ;
289282 }
You can’t perform that action at this time.
0 commit comments