Skip to content

Commit 484bc15

Browse files
macurtis-amdronlieb
authored andcommitted
[clang] Teach opaque offload driver to pass args to opt
Change-Id: I1e3e67b36a3ebc3ffb84a80732cf33c0bd096348
1 parent c31f318 commit 484bc15

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

clang/include/clang/Driver/Options.td

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1056,6 +1056,9 @@ def Xlinker : Separate<["-"], "Xlinker">, Flags<[LinkerInput, RenderAsInput]>,
10561056
def Xoffload_linker : JoinedAndSeparate<["-"], "Xoffload-linker">,
10571057
HelpText<"Pass <arg> to the offload linkers or the ones idenfied by -<triple>">,
10581058
MetaVarName<"<triple> <arg>">, Group<Link_Group>;
1059+
def Xopaque_offload_opt : Separate<["-"], "Xopaque-offload-opt">,
1060+
HelpText<"Pass <arg> to the opaque offload optimizer">,
1061+
MetaVarName<"<arg>">, Visibility<[ClangOption, FlangOption]>;
10591062
def Xpreprocessor : Separate<["-"], "Xpreprocessor">, Group<Preprocessor_Group>,
10601063
HelpText<"Pass <arg> to the preprocessor">, MetaVarName<"<arg>">;
10611064
def X_Flag : Flag<["-"], "X">, Group<Link_Group>;

clang/lib/Driver/ToolChains/Clang.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9437,6 +9437,13 @@ void LinkerWrapper::ConstructOpaqueJob(Compilation &C, const JobAction &JA,
94379437

94389438
// ---------- Step 4 opt -----------
94399439
ArgStringList OptArgs;
9440+
9441+
// Forward -Xopaque-offload-opt arguments to the 'opt' job.
9442+
for (Arg *A : Args.filtered(options::OPT_Xopaque_offload_opt)) {
9443+
OptArgs.push_back(A->getValue());
9444+
A->claim();
9445+
}
9446+
94409447
auto OptOutputFileName = amdgpu::dlr::getOptCommandArgs(
94419448
C, Args, OptArgs, TheTriple, TargetID, OutputFilePrefix,
94429449
LinkOutputFileName);

0 commit comments

Comments
 (0)