@@ -10350,33 +10350,45 @@ void OffloadWrapper::ConstructJob(Compilation &C, const JobAction &JA,
1035010350 assert (JA.getInputs ().size () == Inputs.size () &&
1035110351 " Not have inputs for all dependence actions??" );
1035210352
10353- // For FPGA, we wrap the host objects before archiving them when using
10354- // -fsycl-link. This allows for better extraction control from the
10355- // archive when we need the host objects for subsequent compilations.
1035610353 if (OffloadingKind == Action::OFK_None &&
10357- C.getArgs ().hasArg (options::OPT_fintelfpga) &&
1035810354 C.getArgs ().hasArg (options::OPT_fsycl_link_EQ)) {
1035910355
10360- // Add offload targets and inputs.
10361- CmdArgs.push_back (C.getArgs ().MakeArgString (
10362- Twine (" -kind=" ) + Action::GetOffloadKindName (OffloadingKind)));
10363- CmdArgs.push_back (
10364- TCArgs.MakeArgString (Twine (" -target=" ) + Triple.getTriple ()));
10356+ // When compiling and linking separately, we need to propagate the
10357+ // compression related CLI options to offload-wrapper.
10358+ if (C.getInputArgs ().getLastArg (options::OPT_offload_compress)) {
10359+ CmdArgs.push_back (C.getArgs ().MakeArgString (Twine (" -offload-compress" )));
10360+ // -offload-compression-level=<>
10361+ if (Arg *A = C.getInputArgs ().getLastArg (
10362+ options::OPT_offload_compression_level_EQ))
10363+ CmdArgs.push_back (C.getArgs ().MakeArgString (
10364+ Twine (" -offload-compression-level=" ) + A->getValue ()));
10365+ }
1036510366
10366- if (Inputs[0 ].getType () == types::TY_Tempfiletable ||
10367- Inputs[0 ].getType () == types::TY_Tempfilelist)
10368- // Input files are passed via the batch job file table.
10369- CmdArgs.push_back (C.getArgs ().MakeArgString (" -batch" ));
10367+ // For FPGA, we wrap the host objects before archiving them when using
10368+ // -fsycl-link. This allows for better extraction control from the
10369+ // archive when we need the host objects for subsequent compilations.
10370+ if (C.getArgs ().hasArg (options::OPT_fintelfpga)) {
10371+ // Add offload targets and inputs.
10372+ CmdArgs.push_back (C.getArgs ().MakeArgString (
10373+ Twine (" -kind=" ) + Action::GetOffloadKindName (OffloadingKind)));
10374+ CmdArgs.push_back (
10375+ TCArgs.MakeArgString (Twine (" -target=" ) + Triple.getTriple ()));
1037010376
10371- // Add input.
10372- assert (Inputs[0 ].isFilename () && " Invalid input." );
10373- CmdArgs.push_back (TCArgs.MakeArgString (Inputs[0 ].getFilename ()));
10377+ if (Inputs[0 ].getType () == types::TY_Tempfiletable ||
10378+ Inputs[0 ].getType () == types::TY_Tempfilelist)
10379+ // Input files are passed via the batch job file table.
10380+ CmdArgs.push_back (C.getArgs ().MakeArgString (" -batch" ));
1037410381
10375- C.addCommand (std::make_unique<Command>(
10376- JA, *this , ResponseFileSupport::None (),
10377- TCArgs.MakeArgString (getToolChain ().GetProgramPath (getShortName ())),
10378- CmdArgs, Inputs));
10379- return ;
10382+ // Add input.
10383+ assert (Inputs[0 ].isFilename () && " Invalid input." );
10384+ CmdArgs.push_back (TCArgs.MakeArgString (Inputs[0 ].getFilename ()));
10385+
10386+ C.addCommand (std::make_unique<Command>(
10387+ JA, *this , ResponseFileSupport::None (),
10388+ TCArgs.MakeArgString (getToolChain ().GetProgramPath (getShortName ())),
10389+ CmdArgs, Inputs));
10390+ return ;
10391+ }
1038010392 }
1038110393
1038210394 // Add offload targets and inputs.
0 commit comments