@@ -321,29 +321,29 @@ pub(crate) fn differentiate<'ll>(
321321
322322 // FIXME(ZuseZ4): support SanitizeHWAddress and prevent illegal/unsupported opts
323323
324- // if let Some(opt_level) = config.opt_level {
325- // let opt_stage = match cgcx.lto {
326- // Lto::Fat => llvm::OptStage::PreLinkFatLTO,
327- // Lto::Thin | Lto::ThinLocal => llvm::OptStage::PreLinkThinLTO,
328- // _ if cgcx.opts.cg.linker_plugin_lto.enabled() => llvm::OptStage::PreLinkThinLTO,
329- // _ => llvm::OptStage::PreLinkNoLTO,
330- // };
331- // // This is our second opt call, so now we run all opts,
332- // // to make sure we get the best performance.
333- // let skip_size_increasing_opts = false;
334- // trace!("running Module Optimization after differentiation");
335- // unsafe {
336- // llvm_optimize(
337- // cgcx,
338- // diag_handler.handle(),
339- // module,
340- // config,
341- // opt_level,
342- // opt_stage,
343- // skip_size_increasing_opts,
344- // )?
345- // };
346- // }
324+ if let Some ( opt_level) = config. opt_level {
325+ let opt_stage = match cgcx. lto {
326+ Lto :: Fat => llvm:: OptStage :: PreLinkFatLTO ,
327+ Lto :: Thin | Lto :: ThinLocal => llvm:: OptStage :: PreLinkThinLTO ,
328+ _ if cgcx. opts . cg . linker_plugin_lto . enabled ( ) => llvm:: OptStage :: PreLinkThinLTO ,
329+ _ => llvm:: OptStage :: PreLinkNoLTO ,
330+ } ;
331+ // This is our second opt call, so now we run all opts,
332+ // to make sure we get the best performance.
333+ let skip_size_increasing_opts = false ;
334+ trace ! ( "running Module Optimization after differentiation" ) ;
335+ unsafe {
336+ llvm_optimize (
337+ cgcx,
338+ diag_handler. handle ( ) ,
339+ module,
340+ config,
341+ opt_level,
342+ opt_stage,
343+ skip_size_increasing_opts,
344+ ) ?
345+ } ;
346+ }
347347 trace ! ( "done with differentiate()" ) ;
348348
349349 Ok ( ( ) )
0 commit comments