@@ -7812,8 +7812,15 @@ void SYCLPostLink::ConstructJob(Compilation &C, const JobAction &JA,
78127812 // OPT_fsycl_device_code_split is not checked as it is an alias to
78137813 // -fsycl-device-code-split=per_source
78147814
7815+ auto *SYCLPostLink = llvm::dyn_cast<SYCLPostLinkJobAction>(&JA);
7816+ bool InDeadCodeRemoval = false ;
7817+ if (SYCLPostLink && SYCLPostLink->getDeadCodeRemoval ()) {
7818+ addArgs (CmdArgs, TCArgs, {" --dead-code-removal" });
7819+ InDeadCodeRemoval = true ;
7820+ }
7821+
78157822 // Turn on Dead Parameter Elimination Optimization with early optimizations
7816- if (!getToolChain ().getTriple ().isNVPTX () &&
7823+ if (!getToolChain ().getTriple ().isNVPTX () && !InDeadCodeRemoval &&
78177824 TCArgs.hasFlag (options::OPT_fsycl_dead_args_optimization,
78187825 options::OPT_fno_sycl_dead_args_optimization, false ))
78197826 addArgs (CmdArgs, TCArgs, {" -emit-param-info" });
@@ -7829,14 +7836,11 @@ void SYCLPostLink::ConstructJob(Compilation &C, const JobAction &JA,
78297836 addArgs (CmdArgs, TCArgs, {" -symbols" });
78307837 }
78317838 // specialization constants processing is mandatory
7832- auto *SYCLPostLink = llvm::dyn_cast<SYCLPostLinkJobAction>(&JA);
78337839 if (SYCLPostLink && SYCLPostLink->getRTSetsSpecConstants ())
78347840 addArgs (CmdArgs, TCArgs, {" -spec-const=rt" });
78357841 else
78367842 addArgs (CmdArgs, TCArgs, {" -spec-const=default" });
78377843
7838- if (SYCLPostLink && SYCLPostLink->getDeadCodeRemoval ())
7839- addArgs (CmdArgs, TCArgs, {" --dead-code-removal" });
78407844 // Add output file table file option
78417845 assert (Output.isFilename () && " output must be a filename" );
78427846 addArgs (CmdArgs, TCArgs, {" -o" , Output.getFilename ()});
0 commit comments