Skip to content

Commit af8d766

Browse files
authored
merge main into amd-staging (llvm#1920)
2 parents 50fd459 + 91987e4 commit af8d766

File tree

126 files changed

+2208
-1279
lines changed

Some content is hidden

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

126 files changed

+2208
-1279
lines changed

bolt/test/non-empty-debug-line.test

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
REQUIRES: system-linux
55

66
RUN: %clang %cflags %S/Inputs/hello.c -g -o %t
7-
RUN: llvm-bolt %t -o %t1 --update-debug-sections --funcs=_start
7+
RUN: llvm-bolt %t -o %t1 --update-debug-sections --funcs=_start --keep-nops
88
RUN: llvm-readobj -S %t > %t2
99
RUN: llvm-readobj -S %t1 >> %t2
1010
RUN: FileCheck %s --input-file %t2

clang/include/clang/Frontend/ASTUnit.h

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ class ASTUnit {
106106
};
107107

108108
private:
109-
std::shared_ptr<LangOptions> LangOpts;
109+
std::unique_ptr<LangOptions> LangOpts;
110110
IntrusiveRefCntPtr<DiagnosticsEngine> Diagnostics;
111111
IntrusiveRefCntPtr<FileManager> FileMgr;
112112
IntrusiveRefCntPtr<SourceManager> SourceMgr;
@@ -698,19 +698,17 @@ class ASTUnit {
698698
/// lifetime is expected to extend past that of the returned ASTUnit.
699699
///
700700
/// \returns - The initialized ASTUnit or null if the AST failed to load.
701-
static std::unique_ptr<ASTUnit>
702-
LoadFromASTFile(StringRef Filename, const PCHContainerReader &PCHContainerRdr,
703-
WhatToLoad ToLoad,
704-
IntrusiveRefCntPtr<DiagnosticsEngine> Diags,
705-
const FileSystemOptions &FileSystemOpts,
706-
const HeaderSearchOptions &HSOpts,
707-
std::shared_ptr<LangOptions> LangOpts = nullptr,
708-
bool OnlyLocalDecls = false,
709-
CaptureDiagsKind CaptureDiagnostics = CaptureDiagsKind::None,
710-
bool AllowASTWithCompilerErrors = false,
711-
bool UserFilesAreVolatile = false,
712-
IntrusiveRefCntPtr<llvm::vfs::FileSystem> VFS =
713-
llvm::vfs::getRealFileSystem());
701+
static std::unique_ptr<ASTUnit> LoadFromASTFile(
702+
StringRef Filename, const PCHContainerReader &PCHContainerRdr,
703+
WhatToLoad ToLoad, IntrusiveRefCntPtr<DiagnosticsEngine> Diags,
704+
const FileSystemOptions &FileSystemOpts,
705+
const HeaderSearchOptions &HSOpts, const LangOptions *LangOpts = nullptr,
706+
bool OnlyLocalDecls = false,
707+
CaptureDiagsKind CaptureDiagnostics = CaptureDiagsKind::None,
708+
bool AllowASTWithCompilerErrors = false,
709+
bool UserFilesAreVolatile = false,
710+
IntrusiveRefCntPtr<llvm::vfs::FileSystem> VFS =
711+
llvm::vfs::getRealFileSystem());
714712

715713
private:
716714
/// Helper function for \c LoadFromCompilerInvocation() and

clang/include/clang/Frontend/CompilerInstance.h

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -327,9 +327,6 @@ class CompilerInstance : public ModuleLoader {
327327

328328
LangOptions &getLangOpts() { return Invocation->getLangOpts(); }
329329
const LangOptions &getLangOpts() const { return Invocation->getLangOpts(); }
330-
std::shared_ptr<LangOptions> getLangOptsPtr() const {
331-
return Invocation->getLangOptsPtr();
332-
}
333330

334331
PreprocessorOptions &getPreprocessorOpts() {
335332
return Invocation->getPreprocessorOpts();
@@ -839,16 +836,23 @@ class CompilerInstance : public ModuleLoader {
839836
class ThreadSafeCloneConfig {
840837
IntrusiveRefCntPtr<llvm::vfs::FileSystem> VFS;
841838
DiagnosticConsumer &DiagConsumer;
839+
std::shared_ptr<ModuleDependencyCollector> ModuleDepCollector;
842840

843841
public:
844-
ThreadSafeCloneConfig(IntrusiveRefCntPtr<llvm::vfs::FileSystem> VFS,
845-
DiagnosticConsumer &DiagConsumer)
846-
: VFS(std::move(VFS)), DiagConsumer(DiagConsumer) {
842+
ThreadSafeCloneConfig(
843+
IntrusiveRefCntPtr<llvm::vfs::FileSystem> VFS,
844+
DiagnosticConsumer &DiagConsumer,
845+
std::shared_ptr<ModuleDependencyCollector> ModuleDepCollector = nullptr)
846+
: VFS(std::move(VFS)), DiagConsumer(DiagConsumer),
847+
ModuleDepCollector(std::move(ModuleDepCollector)) {
847848
assert(this->VFS && "Clone config requires non-null VFS");
848849
}
849850

850851
IntrusiveRefCntPtr<llvm::vfs::FileSystem> getVFS() const { return VFS; }
851852
DiagnosticConsumer &getDiagConsumer() const { return DiagConsumer; }
853+
std::shared_ptr<ModuleDependencyCollector> getModuleDepCollector() const {
854+
return ModuleDepCollector;
855+
}
852856
};
853857

854858
private:

clang/include/clang/Frontend/CompilerInvocation.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -265,12 +265,6 @@ class CompilerInvocation : public CompilerInvocationBase {
265265
}
266266
/// @}
267267

268-
/// Base class internals.
269-
/// @{
270-
using CompilerInvocationBase::LangOpts;
271-
std::shared_ptr<LangOptions> getLangOptsPtr() { return LangOpts; }
272-
/// @}
273-
274268
/// Create a compiler invocation from a list of input options.
275269
/// \returns true on success.
276270
///

clang/lib/AST/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,5 +145,5 @@ add_clang_library(clangAST
145145
ClangDriverOptions
146146
intrinsics_gen
147147
# These generated headers are included transitively.
148-
AArch64TargetParserTableGen
148+
target_parser_gen
149149
)

clang/lib/Basic/CMakeLists.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,8 +134,7 @@ add_clang_library(clangBasic
134134
omp_gen
135135
ClangDriverOptions
136136
# These generated headers are included transitively.
137-
ARMTargetParserTableGen
138-
AArch64TargetParserTableGen
137+
target_parser_gen
139138
)
140139

141140
target_link_libraries(clangBasic

clang/lib/CIR/CodeGen/CIRGenExprScalar.cpp

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1010,6 +1010,55 @@ mlir::Value ScalarExprEmitter::emitCompoundAssign(
10101010

10111011
} // namespace
10121012

1013+
LValue
1014+
CIRGenFunction::emitCompoundAssignmentLValue(const CompoundAssignOperator *e) {
1015+
ScalarExprEmitter emitter(*this, builder);
1016+
mlir::Value result;
1017+
switch (e->getOpcode()) {
1018+
#define COMPOUND_OP(Op) \
1019+
case BO_##Op##Assign: \
1020+
return emitter.emitCompoundAssignLValue(e, &ScalarExprEmitter::emit##Op, \
1021+
result)
1022+
COMPOUND_OP(Mul);
1023+
COMPOUND_OP(Div);
1024+
COMPOUND_OP(Rem);
1025+
COMPOUND_OP(Add);
1026+
COMPOUND_OP(Sub);
1027+
COMPOUND_OP(Shl);
1028+
COMPOUND_OP(Shr);
1029+
COMPOUND_OP(And);
1030+
COMPOUND_OP(Xor);
1031+
COMPOUND_OP(Or);
1032+
#undef COMPOUND_OP
1033+
1034+
case BO_PtrMemD:
1035+
case BO_PtrMemI:
1036+
case BO_Mul:
1037+
case BO_Div:
1038+
case BO_Rem:
1039+
case BO_Add:
1040+
case BO_Sub:
1041+
case BO_Shl:
1042+
case BO_Shr:
1043+
case BO_LT:
1044+
case BO_GT:
1045+
case BO_LE:
1046+
case BO_GE:
1047+
case BO_EQ:
1048+
case BO_NE:
1049+
case BO_Cmp:
1050+
case BO_And:
1051+
case BO_Xor:
1052+
case BO_Or:
1053+
case BO_LAnd:
1054+
case BO_LOr:
1055+
case BO_Assign:
1056+
case BO_Comma:
1057+
llvm_unreachable("Not valid compound assignment operators");
1058+
}
1059+
llvm_unreachable("Unhandled compound assignment operator");
1060+
}
1061+
10131062
/// Emit the computation of the specified expression of scalar type.
10141063
mlir::Value CIRGenFunction::emitScalarExpr(const Expr *e) {
10151064
assert(e && hasScalarEvaluationKind(e->getType()) &&

clang/lib/CIR/CodeGen/CIRGenFunction.cpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -517,6 +517,19 @@ LValue CIRGenFunction::emitLValue(const Expr *e) {
517517
return emitMemberExpr(cast<MemberExpr>(e));
518518
case Expr::BinaryOperatorClass:
519519
return emitBinaryOperatorLValue(cast<BinaryOperator>(e));
520+
case Expr::CompoundAssignOperatorClass: {
521+
QualType ty = e->getType();
522+
if (const AtomicType *at = ty->getAs<AtomicType>()) {
523+
cgm.errorNYI(e->getSourceRange(),
524+
"CompoundAssignOperator with AtomicType");
525+
return LValue();
526+
}
527+
if (!ty->isAnyComplexType())
528+
return emitCompoundAssignmentLValue(cast<CompoundAssignOperator>(e));
529+
cgm.errorNYI(e->getSourceRange(),
530+
"CompoundAssignOperator with ComplexType");
531+
return LValue();
532+
}
520533
case Expr::ParenExprClass:
521534
return emitLValue(cast<ParenExpr>(e)->getSubExpr());
522535
case Expr::DeclRefExprClass:

clang/lib/CIR/CodeGen/CIRGenFunction.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -482,6 +482,8 @@ class CIRGenFunction : public CIRGenTypeCache {
482482
mlir::Type condType,
483483
bool buildingTopLevelCase);
484484

485+
LValue emitCompoundAssignmentLValue(const clang::CompoundAssignOperator *e);
486+
485487
mlir::LogicalResult emitContinueStmt(const clang::ContinueStmt &s);
486488
mlir::LogicalResult emitDoStmt(const clang::DoStmt &s);
487489

clang/lib/CodeGen/CGStmtOpenMP.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4851,8 +4851,9 @@ void CodeGenFunction::EmitOMPSectionsDirective(const OMPSectionsDirective &S) {
48514851
using InsertPointTy = llvm::OpenMPIRBuilder::InsertPointTy;
48524852
using BodyGenCallbackTy = llvm::OpenMPIRBuilder::StorableBodyGenCallbackTy;
48534853

4854-
auto FiniCB = [this](InsertPointTy IP) {
4855-
OMPBuilderCBHelpers::FinalizeOMPRegion(*this, IP);
4854+
auto FiniCB = [](InsertPointTy IP) {
4855+
// Don't FinalizeOMPRegion because this is done inside of OMPIRBuilder for
4856+
// sections.
48564857
return llvm::Error::success();
48574858
};
48584859

0 commit comments

Comments
 (0)