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 {
309
309
impl SpirvCodegenBackend {
310
310
fn optimize_common (
311
311
_cgcx : & CodegenContext < Self > ,
312
- _module : & mut ModuleCodegen < <Self as WriteBackendMethods >:: Module > ,
312
+ module : & mut ModuleCodegen < <Self as WriteBackendMethods >:: Module > ,
313
313
) -> 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
+
316
323
Ok ( ( ) )
317
324
}
318
325
}
Original file line number Diff line number Diff line change 1
1
#[ cfg( test) ]
2
2
mod test;
3
3
4
- mod dce;
4
+ pub ( crate ) mod dce;
5
5
mod destructure_composites;
6
6
mod duplicates;
7
7
mod entry_interface;
@@ -277,13 +277,6 @@ pub fn link(
277
277
output
278
278
} ;
279
279
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.
287
280
if let Some ( dir) = & opts. dump_post_merge {
288
281
dump_spv_and_spirt ( & output, dir. join ( disambiguated_crate_name_for_dumps) ) ;
289
282
}
You can’t perform that action at this time.
0 commit comments