Skip to content

Commit 55493de

Browse files
authored
merge main into amd-staging (llvm#1728)
2 parents 3dbc0e0 + 15f5967 commit 55493de

File tree

115 files changed

+2143
-1404
lines changed

Some content is hidden

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

115 files changed

+2143
-1404
lines changed

bolt/lib/Target/RISCV/RISCVMCPlusBuilder.cpp

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -555,9 +555,9 @@ class RISCVMCPlusBuilder : public MCPlusBuilder {
555555
.addReg(RegCnt);
556556
}
557557

558-
InstructionListType createCmpJE(MCPhysReg RegNo, MCPhysReg RegTmp,
559-
const MCSymbol *Target,
560-
MCContext *Ctx) const {
558+
InstructionListType createRegCmpJE(MCPhysReg RegNo, MCPhysReg RegTmp,
559+
const MCSymbol *Target,
560+
MCContext *Ctx) const {
561561
InstructionListType Insts;
562562
Insts.emplace_back(
563563
MCInstBuilder(RISCV::SUB).addReg(RegTmp).addReg(RegNo).addReg(RegNo));
@@ -718,7 +718,7 @@ class RISCVMCPlusBuilder : public MCPlusBuilder {
718718
Insts.emplace_back();
719719
loadReg(Insts.back(), RISCV::X10, RISCV::X10, 0);
720720
InstructionListType cmpJmp =
721-
createCmpJE(RISCV::X10, RISCV::X11, IndCallHandler, Ctx);
721+
createRegCmpJE(RISCV::X10, RISCV::X11, IndCallHandler, Ctx);
722722
Insts.insert(Insts.end(), cmpJmp.begin(), cmpJmp.end());
723723
Insts.emplace_back();
724724
createStackPointerIncrement(Insts.back(), 16);
@@ -777,14 +777,13 @@ class RISCVMCPlusBuilder : public MCPlusBuilder {
777777
return createGetter(Ctx, "__bolt_instr_num_funcs");
778778
}
779779

780-
void convertIndirectCallToLoad(MCInst &Inst, MCPhysReg Reg,
781-
MCPhysReg ZeroReg) const {
780+
void convertIndirectCallToLoad(MCInst &Inst, MCPhysReg Reg) override {
782781
bool IsTailCall = isTailCall(Inst);
783782
if (IsTailCall)
784783
removeAnnotation(Inst, MCPlus::MCAnnotation::kTailCall);
785784
Inst.setOpcode(RISCV::ADD);
786785
Inst.insert(Inst.begin(), MCOperand::createReg(Reg));
787-
Inst.insert(Inst.begin() + 1, MCOperand::createReg(ZeroReg));
786+
Inst.insert(Inst.begin() + 1, MCOperand::createReg(RISCV::X0));
788787
return;
789788
}
790789

@@ -845,7 +844,7 @@ class RISCVMCPlusBuilder : public MCPlusBuilder {
845844
InstructionListType Insts;
846845
spillRegs(Insts, {RISCV::X10, RISCV::X11});
847846
Insts.emplace_back(CallInst);
848-
convertIndirectCallToLoad(Insts.back(), RISCV::X10, RISCV::X0);
847+
convertIndirectCallToLoad(Insts.back(), RISCV::X10);
849848
InstructionListType LoadImm = createLoadImmediate(RISCV::X11, CallSiteID);
850849
Insts.insert(Insts.end(), LoadImm.begin(), LoadImm.end());
851850
spillRegs(Insts, {RISCV::X10, RISCV::X11});

clang/cmake/caches/Fuchsia-stage2.cmake

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -459,6 +459,7 @@ set(LLVM_TOOLCHAIN_TOOLS
459459
llvm-libtool-darwin
460460
llvm-lipo
461461
llvm-ml
462+
llvm-mt
462463
llvm-nm
463464
llvm-objcopy
464465
llvm-objdump
@@ -480,10 +481,6 @@ set(LLVM_TOOLCHAIN_TOOLS
480481
scan-build-py
481482
CACHE STRING "")
482483

483-
if (LLVM_ENABLE_LIBXML2)
484-
list(APPEND LLVM_TOOLCHAIN_TOOLS llvm-mt)
485-
endif()
486-
487484
set(LLVM_Toolchain_DISTRIBUTION_COMPONENTS
488485
bolt
489486
clang

clang/docs/LibASTImporter.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -468,7 +468,7 @@ Note, there may be several different ASTImporter objects which import into the s
468468
cxxRecordDecl(hasName("Y"), isDefinition()), ToUnit);
469469
ToYDef->dump();
470470
// An error is set for "ToYDef" in the shared state.
471-
Optional<ASTImportError> OptErr =
471+
std::optional<ASTImportError> OptErr =
472472
ImporterState->getImportDeclErrorIfAny(ToYDef);
473473
assert(OptErr);
474474

clang/include/clang/AST/RecordLayout.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,9 @@ class ASTRecordLayout {
7575
// performance or backwards compatibility preserving (e.g. AIX-ABI).
7676
CharUnits PreferredAlignment;
7777

78-
// UnadjustedAlignment - Maximum of the alignments of the record members in
79-
// characters.
78+
// UnadjustedAlignment - Alignment of record in characters before alignment
79+
// adjustments. Maximum of the alignments of the record members and base
80+
// classes in characters.
8081
CharUnits UnadjustedAlignment;
8182

8283
/// RequiredAlignment - The required alignment of the object. In the MS-ABI
@@ -186,7 +187,7 @@ class ASTRecordLayout {
186187
CharUnits getPreferredAlignment() const { return PreferredAlignment; }
187188

188189
/// getUnadjustedAlignment - Get the record alignment in characters, before
189-
/// alignment adjustement.
190+
/// alignment adjustment.
190191
CharUnits getUnadjustedAlignment() const { return UnadjustedAlignment; }
191192

192193
/// getSize - Get the record size in characters.

clang/include/clang/Driver/Options.td

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8049,9 +8049,13 @@ def code_completion_with_fixits : Flag<["-"], "code-completion-with-fixits">,
80498049
def skip_function_bodies : Flag<["-"], "skip-function-bodies">,
80508050
HelpText<"Skip function bodies when possible">,
80518051
MarshallingInfoFlag<FrontendOpts<"SkipFunctionBodies">>;
8052-
def disable_free : Flag<["-"], "disable-free">,
8053-
HelpText<"Disable freeing of memory on exit">,
8054-
MarshallingInfoFlag<FrontendOpts<"DisableFree">>;
8052+
defm disable_free : BoolOption<"",
8053+
"disable-free",
8054+
FrontendOpts<"DisableFree">,
8055+
DefaultFalse,
8056+
PosFlag<SetTrue, [], [ClangOption], "Disable">,
8057+
NegFlag<SetFalse, [], [ClangOption], "Don't disable">,
8058+
BothFlags<[], [ClangOption], " freeing of memory on exit">>;
80558059
defm clear_ast_before_backend : BoolOption<"",
80568060
"clear-ast-before-backend",
80578061
CodeGenOpts<"ClearASTBeforeBackend">,

clang/lib/AST/ItaniumMangle.cpp

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1405,16 +1405,6 @@ void CXXNameMangler::mangleUnresolvedPrefix(NestedNameSpecifier *qualifier,
14051405
// - a template template parameter with arguments
14061406
// In all of these cases, we should have no prefix.
14071407
if (NestedNameSpecifier *Prefix = qualifier->getPrefix()) {
1408-
if (const auto *DTST =
1409-
dyn_cast<DependentTemplateSpecializationType>(type)) {
1410-
Out << "srN";
1411-
TemplateName Template = getASTContext().getDependentTemplateName(
1412-
{Prefix, DTST->getDependentTemplateName().getName(),
1413-
/*HasTemplateKeyword=*/true});
1414-
mangleTemplatePrefix(Template);
1415-
mangleTemplateArgs(Template, DTST->template_arguments());
1416-
break;
1417-
}
14181408
mangleUnresolvedPrefix(Prefix,
14191409
/*recursive=*/true);
14201410
} else {
@@ -2618,7 +2608,8 @@ bool CXXNameMangler::mangleUnresolvedTypeOrSimpleId(QualType Ty,
26182608
cast<DependentTemplateSpecializationType>(Ty);
26192609
TemplateName Template = getASTContext().getDependentTemplateName(
26202610
DTST->getDependentTemplateName());
2621-
mangleTemplatePrefix(Template);
2611+
const DependentTemplateStorage &S = DTST->getDependentTemplateName();
2612+
mangleSourceName(S.getName().getIdentifier());
26222613
mangleTemplateArgs(Template, DTST->template_arguments());
26232614
break;
26242615
}

clang/lib/AST/RecordLayoutBuilder.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1302,6 +1302,7 @@ ItaniumRecordLayoutBuilder::LayoutBase(const BaseSubobjectInfo *Base) {
13021302
setSize(std::max(getSize(), Offset + Layout.getSize()));
13031303

13041304
// Remember max struct/class alignment.
1305+
UnadjustedAlignment = std::max(UnadjustedAlignment, BaseAlign);
13051306
UpdateAlignment(BaseAlign, UnpackedAlignTo, PreferredBaseAlign);
13061307

13071308
return Offset;

clang/lib/CIR/CodeGen/CIRGenStmtOpenACC.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ class OpenACCClauseCIREmitter final
124124

125125
for (const DeviceTypeArgument &arg : clause.getArchitectures()) {
126126
deviceTypes.push_back(mlir::acc::DeviceTypeAttr::get(
127-
builder.getContext(), decodeDeviceType(arg.first)));
127+
builder.getContext(), decodeDeviceType(arg.getIdentifierInfo())));
128128
}
129129
operation.removeDeviceTypesAttr();
130130
operation.setDeviceTypesAttr(
@@ -135,7 +135,7 @@ class OpenACCClauseCIREmitter final
135135

136136
if (!clause.getArchitectures().empty())
137137
operation.setDeviceType(
138-
decodeDeviceType(clause.getArchitectures()[0].first));
138+
decodeDeviceType(clause.getArchitectures()[0].getIdentifierInfo()));
139139
} else {
140140
return clauseNotImplemented(clause);
141141
}

clang/lib/Driver/SanitizerArgs.cpp

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -262,11 +262,8 @@ static SanitizerMask setGroupBits(SanitizerMask Kinds) {
262262
}
263263

264264
// Computes the sanitizer mask as:
265-
// Default + Arguments (in or out)
265+
// Default + Arguments (in or out) + AlwaysIn - AlwaysOut
266266
// with arguments parsed from left to right.
267-
//
268-
// Error messages are printed if the AlwaysIn or AlwaysOut invariants are
269-
// violated, but the caller must enforce these invariants themselves.
270267
static SanitizerMask
271268
parseSanitizeArgs(const Driver &D, const llvm::opt::ArgList &Args,
272269
bool DiagnoseErrors, SanitizerMask Default,
@@ -316,6 +313,9 @@ parseSanitizeArgs(const Driver &D, const llvm::opt::ArgList &Args,
316313
}
317314
}
318315

316+
Output |= AlwaysIn;
317+
Output &= ~AlwaysOut;
318+
319319
return Output;
320320
}
321321

@@ -325,10 +325,6 @@ static SanitizerMask parseSanitizeTrapArgs(const Driver &D,
325325
SanitizerMask AlwaysTrap; // Empty
326326
SanitizerMask NeverTrap = ~(setGroupBits(TrappingSupported));
327327

328-
// N.B. We do *not* enforce NeverTrap. This maintains the behavior of
329-
// '-fsanitize=undefined -fsanitize-trap=undefined'
330-
// (clang/test/Driver/fsanitize.c ), which is that vptr is not enabled at all
331-
// (not even in recover mode) in order to avoid the need for a ubsan runtime.
332328
return parseSanitizeArgs(D, Args, DiagnoseErrors, TrappingDefault, AlwaysTrap,
333329
NeverTrap, options::OPT_fsanitize_trap_EQ,
334330
options::OPT_fno_sanitize_trap_EQ);
@@ -727,8 +723,6 @@ SanitizerArgs::SanitizerArgs(const ToolChain &TC,
727723
D, Args, DiagnoseErrors, RecoverableByDefault, AlwaysRecoverable,
728724
Unrecoverable, options::OPT_fsanitize_recover_EQ,
729725
options::OPT_fno_sanitize_recover_EQ);
730-
RecoverableKinds |= AlwaysRecoverable;
731-
RecoverableKinds &= ~Unrecoverable;
732726
RecoverableKinds &= Kinds;
733727

734728
TrappingKinds &= Kinds;

clang/lib/Driver/ToolChains/Clang.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9491,6 +9491,10 @@ void LinkerWrapper::ConstructJob(Compilation &C, const JobAction &JA,
94919491
"--lto-newpm-passes=default-post-link<O" + OOpt + ">"));
94929492
}
94939493
}
9494+
// If this is OpenMP the device linker will need `-lompdevice`.
9495+
if (Kind == Action::OFK_OpenMP && !Args.hasArg(OPT_no_offloadlib) &&
9496+
(TC->getTriple().isAMDGPU() || TC->getTriple().isNVPTX()))
9497+
LinkerArgs.emplace_back("-lompdevice");
94949498

94959499
// Forward all of these to the appropriate toolchain.
94969500
for (StringRef Arg : CompilerArgs)

0 commit comments

Comments
 (0)