Skip to content

Commit de56b85

Browse files
Merge commit '46e6dd84b778dd2e30368183fec265beceecdd0f' into pulldown-ww31
2 parents 4e0c951 + 46e6dd8 commit de56b85

File tree

314 files changed

+11174
-4845
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

314 files changed

+11174
-4845
lines changed

clang-tools-extra/pseudo/include/CMakeLists.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@ if(NOT CLANG_PSEUDO_GEN STREQUAL "clang-pseudo-gen")
88
set(pseudo_gen ${CLANG_PSEUDO_GEN})
99
set(pseudo_gen_target ${CLANG_PSEUDO_GEN})
1010
elseif(LLVM_USE_HOST_TOOLS)
11-
build_native_tool(clang-pseudo-gen pseudo_gen)
11+
# The NATIVE executable *must* depend on the current target, otherwise the
12+
# native one won't get rebuilt when the pseudo-gen sources change.
13+
build_native_tool(clang-pseudo-gen pseudo_gen DEPENDS clang-pseudo-gen)
1214
set(pseudo_gen_target "${pseudo_gen}")
1315
else()
1416
set(pseudo_gen $<TARGET_FILE:clang-pseudo-gen>)

clang-tools-extra/pseudo/lib/cxx/CXX.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ Token::Index recoverBrackets(Token::Index Begin, const TokenStream &Tokens) {
124124
assert(Left.Kind == tok::l_brace || Left.Kind == tok::l_paren ||
125125
Left.Kind == tok::l_square);
126126
if (const Token *Right = Left.pair()) {
127-
assert(Tokens.index(*Right) > Begin);
127+
assert(Tokens.index(*Right) > Begin - 1);
128128
return Tokens.index(*Right);
129129
}
130130
return Token::Invalid;

clang/lib/AST/TextNodeDumper.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1723,6 +1723,9 @@ void TextNodeDumper::VisitFunctionDecl(const FunctionDecl *D) {
17231723
}
17241724
}
17251725

1726+
if (!D->isInlineSpecified() && D->isInlined()) {
1727+
OS << " implicit-inline";
1728+
}
17261729
// Since NumParams comes from the FunctionProtoType of the FunctionDecl and
17271730
// the Params are set later, it is possible for a dump during debugging to
17281731
// encounter a FunctionDecl that has been created but hasn't been assigned

clang/lib/CodeGen/CGStmtOpenMP.cpp

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5203,8 +5203,30 @@ void CodeGenFunction::EmitOMPTaskwaitDirective(const OMPTaskwaitDirective &S) {
52035203
CGM.getOpenMPRuntime().emitTaskwaitCall(*this, S.getBeginLoc(), Data);
52045204
}
52055205

5206+
bool isSupportedByOpenMPIRBuilder(const OMPTaskgroupDirective &T) {
5207+
return T.clauses().empty();
5208+
}
5209+
52065210
void CodeGenFunction::EmitOMPTaskgroupDirective(
52075211
const OMPTaskgroupDirective &S) {
5212+
OMPLexicalScope Scope(*this, S, OMPD_unknown);
5213+
if (CGM.getLangOpts().OpenMPIRBuilder && isSupportedByOpenMPIRBuilder(S)) {
5214+
llvm::OpenMPIRBuilder &OMPBuilder = CGM.getOpenMPRuntime().getOMPBuilder();
5215+
using InsertPointTy = llvm::OpenMPIRBuilder::InsertPointTy;
5216+
InsertPointTy AllocaIP(AllocaInsertPt->getParent(),
5217+
AllocaInsertPt->getIterator());
5218+
5219+
auto BodyGenCB = [&, this](InsertPointTy AllocaIP,
5220+
InsertPointTy CodeGenIP) {
5221+
Builder.restoreIP(CodeGenIP);
5222+
EmitStmt(S.getInnermostCapturedStmt()->getCapturedStmt());
5223+
};
5224+
CodeGenFunction::CGCapturedStmtInfo CapStmtInfo;
5225+
if (!CapturedStmtInfo)
5226+
CapturedStmtInfo = &CapStmtInfo;
5227+
Builder.restoreIP(OMPBuilder.createTaskgroup(Builder, AllocaIP, BodyGenCB));
5228+
return;
5229+
}
52085230
auto &&CodeGen = [&S](CodeGenFunction &CGF, PrePostActionTy &Action) {
52095231
Action.Enter(CGF);
52105232
if (const Expr *E = S.getReductionRef()) {
@@ -5230,7 +5252,6 @@ void CodeGenFunction::EmitOMPTaskgroupDirective(
52305252
}
52315253
CGF.EmitStmt(S.getInnermostCapturedStmt()->getCapturedStmt());
52325254
};
5233-
OMPLexicalScope Scope(*this, S, OMPD_unknown);
52345255
CGM.getOpenMPRuntime().emitTaskgroupRegion(*this, CodeGen, S.getBeginLoc());
52355256
}
52365257

clang/lib/Driver/Driver.cpp

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6765,6 +6765,15 @@ Action *Driver::BuildOffloadingActions(Compilation &C,
67656765
}
67666766
}
67676767

6768+
// Compiling HIP in non-RDC mode requires linking each action individually.
6769+
for (Action *&A : DeviceActions) {
6770+
if (A->getType() != types::TY_Object || Kind != Action::OFK_HIP ||
6771+
Args.hasFlag(options::OPT_fgpu_rdc, options::OPT_fno_gpu_rdc, false))
6772+
continue;
6773+
ActionList LinkerInput = {A};
6774+
A = C.MakeAction<LinkJobAction>(LinkerInput, types::TY_Image);
6775+
}
6776+
67686777
auto TCAndArch = TCAndArchs.begin();
67696778
for (Action *A : DeviceActions) {
67706779
DDeps.add(*A, *TCAndArch->first, TCAndArch->second.data(), Kind);
@@ -6784,12 +6793,21 @@ Action *Driver::BuildOffloadingActions(Compilation &C,
67846793
OffloadAction::DeviceDependences DDep;
67856794
if (C.isOffloadingHostKind(Action::OFK_Cuda) &&
67866795
!Args.hasFlag(options::OPT_fgpu_rdc, options::OPT_fno_gpu_rdc, false)) {
6787-
// If we are not in RDC-mode we just emit the final CUDA fatbinary for each
6788-
// translation unit without requiring any linking.
6796+
// If we are not in RDC-mode we just emit the final CUDA fatbinary for
6797+
// each translation unit without requiring any linking.
67896798
Action *FatbinAction =
67906799
C.MakeAction<LinkJobAction>(OffloadActions, types::TY_CUDA_FATBIN);
67916800
DDep.add(*FatbinAction, *C.getSingleOffloadToolChain<Action::OFK_Cuda>(),
67926801
nullptr, Action::OFK_Cuda);
6802+
} else if (C.isOffloadingHostKind(Action::OFK_HIP) &&
6803+
!Args.hasFlag(options::OPT_fgpu_rdc, options::OPT_fno_gpu_rdc,
6804+
false)) {
6805+
// If we are not in RDC-mode we just emit the final HIP fatbinary for each
6806+
// translation unit, linking each input individually.
6807+
Action *FatbinAction =
6808+
C.MakeAction<LinkJobAction>(OffloadActions, types::TY_HIP_FATBIN);
6809+
DDep.add(*FatbinAction, *C.getSingleOffloadToolChain<Action::OFK_HIP>(),
6810+
nullptr, Action::OFK_HIP);
67936811
} else {
67946812
// Package all the offloading actions into a single output that can be
67956813
// embedded in the host and linked.
@@ -6798,6 +6816,7 @@ Action *Driver::BuildOffloadingActions(Compilation &C,
67986816
DDep.add(*PackagerAction, *C.getSingleOffloadToolChain<Action::OFK_Host>(),
67996817
nullptr, Action::OFK_None);
68006818
}
6819+
68016820
OffloadAction::HostDependence HDep(
68026821
*HostAction, *C.getSingleOffloadToolChain<Action::OFK_Host>(),
68036822
/*BoundArch=*/nullptr, isa<CompileJobAction>(HostAction) ? DDep : DDeps);

clang/lib/Driver/ToolChains/AIX.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -222,11 +222,13 @@ void AIX::AddClangSystemIncludeArgs(const ArgList &DriverArgs,
222222
llvm::StringRef Sysroot = GetHeaderSysroot(DriverArgs);
223223
const Driver &D = getDriver();
224224

225-
// Add the Clang builtin headers (<resource>/include).
226225
if (!DriverArgs.hasArg(options::OPT_nobuiltininc)) {
227226
SmallString<128> P(D.ResourceDir);
228-
path::append(P, "/include");
229-
addSystemInclude(DriverArgs, CC1Args, P.str());
227+
// Add the PowerPC intrinsic headers (<resource>/include/ppc_wrappers)
228+
path::append(P, "include", "ppc_wrappers");
229+
addSystemInclude(DriverArgs, CC1Args, P);
230+
// Add the Clang builtin headers (<resource>/include)
231+
addSystemInclude(DriverArgs, CC1Args, path::parent_path(P.str()));
230232
}
231233

232234
// Return if -nostdlibinc is specified as a driver option.

clang/lib/Driver/ToolChains/Clang.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7518,7 +7518,7 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
75187518
CmdArgs.push_back("-fcuda-include-gpubinary");
75197519
CmdArgs.push_back(CudaDeviceInput->getFilename());
75207520
} else if (!HostOffloadingInputs.empty()) {
7521-
if (IsCuda && !IsRDCMode) {
7521+
if ((IsCuda || IsHIP) && !IsRDCMode) {
75227522
assert(HostOffloadingInputs.size() == 1 && "Only one input expected");
75237523
CmdArgs.push_back("-fcuda-include-gpubinary");
75247524
CmdArgs.push_back(HostOffloadingInputs.front().getFilename());

clang/lib/Driver/ToolChains/Darwin.cpp

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1141,25 +1141,38 @@ void DarwinClang::AddLinkARCArgs(const ArgList &Args,
11411141
SmallString<128> P(getDriver().ClangExecutable);
11421142
llvm::sys::path::remove_filename(P); // 'clang'
11431143
llvm::sys::path::remove_filename(P); // 'bin'
1144+
llvm::sys::path::append(P, "lib", "arc");
11441145

11451146
// 'libarclite' usually lives in the same toolchain as 'clang'. However, the
11461147
// Swift open source toolchains for macOS distribute Clang without libarclite.
11471148
// In that case, to allow the linker to find 'libarclite', we point to the
11481149
// 'libarclite' in the XcodeDefault toolchain instead.
1149-
if (getXcodeDeveloperPath(P).empty()) {
1150-
if (const Arg *A = Args.getLastArg(options::OPT_isysroot)) {
1150+
if (!getVFS().exists(P)) {
1151+
auto updatePath = [&](const Arg *A) {
11511152
// Try to infer the path to 'libarclite' in the toolchain from the
11521153
// specified SDK path.
11531154
StringRef XcodePathForSDK = getXcodeDeveloperPath(A->getValue());
1154-
if (!XcodePathForSDK.empty()) {
1155-
P = XcodePathForSDK;
1156-
llvm::sys::path::append(P, "Toolchains/XcodeDefault.xctoolchain/usr");
1157-
}
1155+
if (XcodePathForSDK.empty())
1156+
return false;
1157+
1158+
P = XcodePathForSDK;
1159+
llvm::sys::path::append(P, "Toolchains/XcodeDefault.xctoolchain/usr",
1160+
"lib", "arc");
1161+
return getVFS().exists(P);
1162+
};
1163+
1164+
bool updated = false;
1165+
if (const Arg *A = Args.getLastArg(options::OPT_isysroot))
1166+
updated = updatePath(A);
1167+
1168+
if (!updated) {
1169+
if (const Arg *A = Args.getLastArg(options::OPT__sysroot_EQ))
1170+
updatePath(A);
11581171
}
11591172
}
11601173

11611174
CmdArgs.push_back("-force_load");
1162-
llvm::sys::path::append(P, "lib", "arc", "libarclite_");
1175+
llvm::sys::path::append(P, "libarclite_");
11631176
// Mash in the platform.
11641177
if (isTargetWatchOSSimulator())
11651178
P += "watchsimulator";

clang/lib/Format/ContinuationIndenter.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -656,6 +656,7 @@ void ContinuationIndenter::addTokenOnCurrentLine(LineState &State, bool DryRun,
656656
int PPColumnCorrection = 0;
657657
if (Style.IndentPPDirectives == FormatStyle::PPDIS_AfterHash &&
658658
Previous.is(tok::hash) && State.FirstIndent > 0 &&
659+
&Previous == State.Line->First &&
659660
(State.Line->Type == LT_PreprocessorDirective ||
660661
State.Line->Type == LT_ImportStatement)) {
661662
Spaces += State.FirstIndent;

clang/lib/Headers/ppc_wrappers/emmintrin.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@
3636
#ifndef EMMINTRIN_H_
3737
#define EMMINTRIN_H_
3838

39-
#if defined(__ppc64__) && (defined(__linux__) || defined(__FreeBSD__))
39+
#if defined(__ppc64__) && \
40+
(defined(__linux__) || defined(__FreeBSD__) || defined(_AIX))
4041

4142
#include <altivec.h>
4243

@@ -2261,7 +2262,7 @@ extern __inline __m128d
22612262

22622263
#else
22632264
#include_next <emmintrin.h>
2264-
#endif /* defined(__ppc64__) && (defined(__linux__) || defined(__FreeBSD__)) \
2265-
*/
2265+
#endif /* defined(__ppc64__) &&
2266+
* (defined(__linux__) || defined(__FreeBSD__) || defined(_AIX)) */
22662267

22672268
#endif /* EMMINTRIN_H_ */

0 commit comments

Comments
 (0)