Vendor import of clang release_80 branch r363030:

https://llvm.org/svn/llvm-project/cfe/branches/release_80@363030
This commit is contained in:
Dimitry Andric 2019-06-11 18:16:50 +00:00
parent d0010a8e4c
commit 70198750b9
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/vendor/clang/dist-release_80/; revision=348934
svn path=/vendor/clang/clang-release_80-r363030/; revision=348950; tag=vendor/clang/clang-release_80-r363030
9 changed files with 70 additions and 24 deletions

View File

@ -36,7 +36,7 @@ std::string getClangRepositoryPath() {
// If the SVN_REPOSITORY is empty, try to use the SVN keyword. This helps us
// pick up a tag in an SVN export, for example.
StringRef SVNRepository("$URL: https://llvm.org/svn/llvm-project/cfe/tags/RELEASE_800/final/lib/Basic/Version.cpp $");
StringRef SVNRepository("$URL: https://llvm.org/svn/llvm-project/cfe/branches/release_80/lib/Basic/Version.cpp $");
if (URL.empty()) {
URL = SVNRepository.slice(SVNRepository.find(':'),
SVNRepository.find("/lib/Basic"));

View File

@ -1518,8 +1518,9 @@ void CodeGenFunction::EmitOMPPrivateLoopCounters(
I < E; ++I) {
const auto *DRE = cast<DeclRefExpr>(C->getLoopCounter(I));
const auto *VD = cast<VarDecl>(DRE->getDecl());
// Override only those variables that are really emitted already.
if (LocalDeclMap.count(VD)) {
// Override only those variables that can be captured to avoid re-emission
// of the variables declared within the loops.
if (DRE->refersToEnclosingVariableOrCapture()) {
(void)LoopScope.addPrivate(VD, [this, DRE, VD]() {
return CreateMemTemp(DRE->getType(), VD->getName());
});

View File

@ -718,8 +718,9 @@ static void appendUserToPath(SmallVectorImpl<char> &Result) {
Result.append(UID.begin(), UID.end());
}
static void addPGOAndCoverageFlags(Compilation &C, const Driver &D,
const InputInfo &Output, const ArgList &Args,
static void addPGOAndCoverageFlags(const ToolChain &TC, Compilation &C,
const Driver &D, const InputInfo &Output,
const ArgList &Args,
ArgStringList &CmdArgs) {
auto *PGOGenerateArg = Args.getLastArg(options::OPT_fprofile_generate,
@ -759,6 +760,11 @@ static void addPGOAndCoverageFlags(Compilation &C, const Driver &D,
ProfileGenerateArg->getValue()));
// The default is to use Clang Instrumentation.
CmdArgs.push_back("-fprofile-instrument=clang");
if (TC.getTriple().isWindowsMSVCEnvironment()) {
// Add dependent lib for clang_rt.profile
CmdArgs.push_back(Args.MakeArgString("--dependent-lib=" +
TC.getCompilerRT(Args, "profile")));
}
}
if (PGOGenerateArg) {
@ -4118,7 +4124,7 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
// sampling, overhead of call arc collection is way too high and there's no
// way to collect the output.
if (!Triple.isNVPTX())
addPGOAndCoverageFlags(C, D, Output, Args, CmdArgs);
addPGOAndCoverageFlags(TC, C, D, Output, Args, CmdArgs);
if (auto *ABICompatArg = Args.getLastArg(options::OPT_fclang_abi_compat_EQ))
ABICompatArg->render(Args, CmdArgs);

View File

@ -45,6 +45,7 @@ static std::string getMultiarchTriple(const Driver &D,
TargetTriple.getEnvironment();
bool IsAndroid = TargetTriple.isAndroid();
bool IsMipsR6 = TargetTriple.getSubArch() == llvm::Triple::MipsSubArch_r6;
bool IsMipsN32Abi = TargetTriple.getEnvironment() == llvm::Triple::GNUABIN32;
// For most architectures, just use whatever we have rather than trying to be
// clever.
@ -103,33 +104,37 @@ static std::string getMultiarchTriple(const Driver &D,
return "aarch64_be-linux-gnu";
break;
case llvm::Triple::mips: {
std::string Arch = IsMipsR6 ? "mipsisa32r6" : "mips";
if (D.getVFS().exists(SysRoot + "/lib/" + Arch + "-linux-gnu"))
return Arch + "-linux-gnu";
std::string MT = IsMipsR6 ? "mipsisa32r6-linux-gnu" : "mips-linux-gnu";
if (D.getVFS().exists(SysRoot + "/lib/" + MT))
return MT;
break;
}
case llvm::Triple::mipsel: {
if (IsAndroid)
return "mipsel-linux-android";
std::string Arch = IsMipsR6 ? "mipsisa32r6el" : "mipsel";
if (D.getVFS().exists(SysRoot + "/lib/" + Arch + "-linux-gnu"))
return Arch + "-linux-gnu";
std::string MT = IsMipsR6 ? "mipsisa32r6el-linux-gnu" : "mipsel-linux-gnu";
if (D.getVFS().exists(SysRoot + "/lib/" + MT))
return MT;
break;
}
case llvm::Triple::mips64: {
std::string Arch = IsMipsR6 ? "mipsisa64r6" : "mips64";
std::string ABI = llvm::Triple::getEnvironmentTypeName(TargetEnvironment);
if (D.getVFS().exists(SysRoot + "/lib/" + Arch + "-linux-" + ABI))
return Arch + "-linux-" + ABI;
std::string MT = std::string(IsMipsR6 ? "mipsisa64r6" : "mips64") +
"-linux-" + (IsMipsN32Abi ? "gnuabin32" : "gnuabi64");
if (D.getVFS().exists(SysRoot + "/lib/" + MT))
return MT;
if (D.getVFS().exists(SysRoot + "/lib/mips64-linux-gnu"))
return "mips64-linux-gnu";
break;
}
case llvm::Triple::mips64el: {
if (IsAndroid)
return "mips64el-linux-android";
std::string Arch = IsMipsR6 ? "mipsisa64r6el" : "mips64el";
std::string ABI = llvm::Triple::getEnvironmentTypeName(TargetEnvironment);
if (D.getVFS().exists(SysRoot + "/lib/" + Arch + "-linux-" + ABI))
return Arch + "-linux-" + ABI;
std::string MT = std::string(IsMipsR6 ? "mipsisa64r6el" : "mips64el") +
"-linux-" + (IsMipsN32Abi ? "gnuabin32" : "gnuabi64");
if (D.getVFS().exists(SysRoot + "/lib/" + MT))
return MT;
if (D.getVFS().exists(SysRoot + "/lib/mips64el-linux-gnu"))
return "mips64el-linux-gnu";
break;
}
case llvm::Triple::ppc:

View File

@ -4602,8 +4602,7 @@ DeclRefExpr *OpenMPIterationSpaceChecker::buildCounterVar(
Captures.insert(std::make_pair(LCRef, Ref));
return Ref;
}
return buildDeclRefExpr(SemaRef, VD, VD->getType().getNonReferenceType(),
DefaultLoc);
return cast<DeclRefExpr>(LCRef);
}
Expr *OpenMPIterationSpaceChecker::buildPrivateCounterVar() const {

View File

@ -66,7 +66,7 @@
// RUN: %clang_cl -### /FA -fprofile-instr-generate=/tmp/somefile.profraw -- %s 2>&1 | FileCheck -check-prefix=CHECK-PROFILE-GENERATE-FILE %s
// RUN: %clang_cl -### /FA -fprofile-instr-generate -fprofile-instr-use -- %s 2>&1 | FileCheck -check-prefix=CHECK-NO-MIX-GEN-USE %s
// RUN: %clang_cl -### /FA -fprofile-instr-generate -fprofile-instr-use=file -- %s 2>&1 | FileCheck -check-prefix=CHECK-NO-MIX-GEN-USE %s
// CHECK-PROFILE-GENERATE: "-fprofile-instrument=clang"
// CHECK-PROFILE-GENERATE: "-fprofile-instrument=clang" "--dependent-lib={{[^"]*}}clang_rt.profile-{{[^"]*}}.lib"
// CHECK-PROFILE-GENERATE-FILE: "-fprofile-instrument-path=/tmp/somefile.profraw"
// CHECK-NO-MIX-GEN-USE: '{{[a-z=-]*}}' not allowed with '{{[a-z=-]*}}'

View File

@ -121,3 +121,17 @@
//
// CHECK-WINDOWS-X86-64: "{{.*}}link{{(.exe)?}}"
// CHECK-WINDOWS-X86-64: "{{.*}}clang_rt.profile-x86_64.lib"
// Test instrumented profiling dependent-lib flags
//
// RUN: %clang %s -### -o %t.o -target x86_64-pc-win32 \
// RUN: -fprofile-instr-generate 2>&1 \
// RUN: | FileCheck --check-prefix=CHECK-WINDOWS-X86-64-DEPENDENT-LIB %s
//
// CHECK-WINDOWS-X86-64-DEPENDENT-LIB: "--dependent-lib={{[^"]*}}clang_rt.profile-{{[^"]*}}.lib"
//
// RUN: %clang %s -### -o %t.o -target x86_64-mingw32 \
// RUN: -fprofile-instr-generate 2>&1 \
// RUN: | FileCheck --check-prefix=CHECK-MINGW-X86-64-DEPENDENT-LIB %s
//
// CHECK-MINGW-X86-64-DEPENDENT-LIB-NOT: "--dependent-lib={{[^"]*}}clang_rt.profile-{{[^"]*}}.a"

View File

@ -1632,6 +1632,11 @@
// CHECK-DEBIAN-ML-MIPS64EL-N32: "-L[[SYSROOT]]/usr/lib"
//
// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
// RUN: --target=mips64-unknown-linux-gnu \
// RUN: --gcc-toolchain="" \
// RUN: --sysroot=%S/Inputs/debian_6_mips64_tree \
// RUN: | FileCheck --check-prefix=CHECK-DEBIAN-ML-MIPS64-GNUABI %s
// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
// RUN: --target=mips64-linux-gnuabi64 -mabi=n64 \
// RUN: --gcc-toolchain="" \
// RUN: --sysroot=%S/Inputs/debian_6_mips64_tree \
@ -1652,6 +1657,11 @@
// CHECK-DEBIAN-ML-MIPS64-GNUABI: "{{.*}}/usr/lib/gcc/mips64-linux-gnuabi64/4.9/../../../mips64-linux-gnuabi64{{/|\\\\}}crtn.o"
//
// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
// RUN: --target=mips64el-unknown-linux-gnu \
// RUN: --gcc-toolchain="" \
// RUN: --sysroot=%S/Inputs/debian_6_mips64_tree \
// RUN: | FileCheck --check-prefix=CHECK-DEBIAN-ML-MIPS64EL-GNUABI %s
// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
// RUN: --target=mips64el-linux-gnuabi64 -mabi=n64 \
// RUN: --gcc-toolchain="" \
// RUN: --sysroot=%S/Inputs/debian_6_mips64_tree \

View File

@ -16,6 +16,17 @@ extern int n;
int a[10], b[10], c[10], d[10];
void foo();
// CHECK-LABEL:bar
void bar() {
int i,j;
// CHECK: call void @__kmpc_doacross_init(
// CHECK: call void @__kmpc_doacross_fini(
#pragma omp parallel for ordered(2)
for (i = 0; i < n; ++i)
for (j = 0; j < n; ++j)
a[i] = b[i] + 1;
}
// CHECK-LABEL: @main()
int main() {
int i;
@ -35,7 +46,7 @@ int main() {
// CHECK: call void @__kmpc_doacross_init([[IDENT]], i32 [[GTID]], i32 1, i8* [[CAST]])
// CHECK: call void @__kmpc_for_static_init_4(
#pragma omp for ordered(1)
for (i = 0; i < n; ++i) {
for (int i = 0; i < n; ++i) {
a[i] = b[i] + 1;
foo();
// CHECK: invoke void [[FOO:.+]](