Skip to content

Commit

Permalink
Fixes to compile SPEC CPU with A+A options
Browse files Browse the repository at this point in the history
Change-Id: Ia9b4cb2ad100c990881ab1d18ee12eefd3ce8152
  • Loading branch information
ronlieb authored and zhang2amd committed May 19, 2022
1 parent 6bae452 commit 50d6d5d
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions clang/lib/Driver/ToolChains/AmdOptArgs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,14 +71,16 @@ static void addCmdArgs(const ArgList &Args, ArgStringList &CmdArgs,
bool noPrefix=false) {
if (checkOnly)
return;
if (noPrefix)
if (isLLD) {
const Twine Str = "-plugin-opt=";
CmdArgs.push_back(Args.MakeArgString(Str + Arg));
} else if (noPrefix) {
CmdArgs.push_back(Arg);
else if (!isLLD) {
} else if (!isLLD) {
CmdArgs.push_back("-mllvm");
CmdArgs.push_back(Arg);
} else {
const Twine Str = "-plugin-opt=";
CmdArgs.push_back(Args.MakeArgString(Str + Arg));
// Nothing, isLLD and !isLLD make this dead patch
}
}

Expand Down Expand Up @@ -141,7 +143,7 @@ static bool checkForPropOpts(const ToolChain &TC, const Driver &D,
if (Arg *A = Args.getLastArg(options::OPT_fstruct_layout_EQ)) {
StringRef Val = A->getValue();
addCmdArgs(Args, CmdArgs, isLLD, checkOnly,
Args.MakeArgString("-struct-layout=" + Val), !isLLD);
Args.MakeArgString("-struct-layout=" + Val), isLLD);
ClosedToolChainNeeded = true;
}

Expand All @@ -160,7 +162,7 @@ static bool checkForPropOpts(const ToolChain &TC, const Driver &D,
}
if (Args.hasFlag(options::OPT_farray_remap, options::OPT_fno_array_remap,
false)) {
addCmdArgs(Args, CmdArgs, isLLD, checkOnly, "-remap-arrays", !isLLD);
addCmdArgs(Args, CmdArgs, isLLD, checkOnly, "-remap-arrays", isLLD);
addCmdArgs(Args, CmdArgs, isLLD, checkOnly, "-simplifycfg-no-storesink");
ClosedToolChainNeeded = true;
}
Expand Down Expand Up @@ -230,7 +232,7 @@ static bool checkForPropOpts(const ToolChain &TC, const Driver &D,
StringRef Val = A->getValue();
addCmdArgs(Args, CmdArgs, isLLD, checkOnly,
Args.MakeArgString("-struct-peel-mem-block-size=" + Val),
!isLLD);
isLLD);
ClosedToolChainNeeded = true;
} else if (Arg *A = Args.getLastArg(options::OPT_march_EQ)) {
if (ClosedToolChainNeeded && HasAltPath) {
Expand All @@ -243,23 +245,23 @@ static bool checkForPropOpts(const ToolChain &TC, const Driver &D,
addCmdArgs(Args, CmdArgs, isLLD, checkOnly,
Args.MakeArgString(
"-struct-peel-mem-block-size=" ZNVER1_MEMBLOCK_SIZE),
!isLLD);
isLLD);
ClosedToolChainNeeded = true;
}
if (MArch == "znver2" || (MArch == "native" && CPU == "znver2")) {
// Tune mem-block-size for znver2
addCmdArgs(Args, CmdArgs, isLLD, checkOnly,
Args.MakeArgString(
"-struct-peel-mem-block-size=" ZNVER2_MEMBLOCK_SIZE),
!isLLD);
isLLD);
ClosedToolChainNeeded = true;
}
if (MArch == "znver3" || (MArch == "native" && CPU == "znver3")) {
// Tune mem-block-size for znver3
addCmdArgs(Args, CmdArgs, isLLD, checkOnly,
Args.MakeArgString(
"-struct-peel-mem-block-size=" ZNVER2_MEMBLOCK_SIZE),
!isLLD);
isLLD);
addCmdArgs(Args, CmdArgs, isLLD, checkOnly,
Args.MakeArgString("-x86-convert-cmpmr-to-cmprm"));
ClosedToolChainNeeded = true;
Expand Down Expand Up @@ -305,7 +307,7 @@ static bool checkForPropOpts(const ToolChain &TC, const Driver &D,
if (Args.hasFlag(options::OPT_flv_function_specialization,
options::OPT_fno_lv_function_specialization, false)) {
addCmdArgs(Args, CmdArgs, isLLD, checkOnly,
"-lv-function-specialization", !isLLD);
"-lv-function-specialization", isLLD);
if (!isLLD)
addCmdArgs(Args, CmdArgs, isLLD, checkOnly, "-delay-vectorization-to-lto");
ClosedToolChainNeeded = true;
Expand Down

0 comments on commit 50d6d5d

Please sign in to comment.