Skip to content

Commit 52a6139

Browse files
committed
Merge remote-tracking branch 'origin/main' into simplify-finalizebundle
2 parents a213065 + f058333 commit 52a6139

File tree

172 files changed

+2196
-1080
lines changed

Some content is hidden

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

172 files changed

+2196
-1080
lines changed

clang/docs/ReleaseNotes.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -901,6 +901,8 @@ OpenMP Support
901901
- Added support 'no_openmp_constructs' assumption clause.
902902
- Added support for 'self_maps' in map and requirement clause.
903903
- Added support for 'omp stripe' directive.
904+
- Fixed a crashing bug with ``omp tile sizes`` if the argument to ``sizes`` was
905+
an invalid expression. (#GH139073)
904906

905907
Improvements
906908
^^^^^^^^^^^^

clang/include/clang/AST/OpenMPClause.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9475,15 +9475,17 @@ class ConstOMPClauseVisitor :
94759475
class OMPClausePrinter final : public OMPClauseVisitor<OMPClausePrinter> {
94769476
raw_ostream &OS;
94779477
const PrintingPolicy &Policy;
9478+
unsigned Version;
94789479

94799480
/// Process clauses with list of variables.
94809481
template <typename T> void VisitOMPClauseList(T *Node, char StartSym);
94819482
/// Process motion clauses.
94829483
template <typename T> void VisitOMPMotionClause(T *Node);
94839484

94849485
public:
9485-
OMPClausePrinter(raw_ostream &OS, const PrintingPolicy &Policy)
9486-
: OS(OS), Policy(Policy) {}
9486+
OMPClausePrinter(raw_ostream &OS, const PrintingPolicy &Policy,
9487+
unsigned OpenMPVersion)
9488+
: OS(OS), Policy(Policy), Version(OpenMPVersion) {}
94879489

94889490
#define GEN_CLANG_CLAUSE_CLASS
94899491
#define CLAUSE_CLASS(Enum, Str, Class) void Visit##Class(Class *S);

clang/include/clang/CIR/MissingFeatures.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,8 @@ struct MissingFeatures {
104104
static bool opCallExtParameterInfo() { return false; }
105105
static bool opCallCIRGenFuncInfoParamInfo() { return false; }
106106
static bool opCallCIRGenFuncInfoExtParamInfo() { return false; }
107+
static bool opCallLandingPad() { return false; }
108+
static bool opCallContinueBlock() { return false; }
107109

108110
// ScopeOp handling
109111
static bool opScopeCleanupRegion() { return false; }

clang/lib/AST/Decl.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3350,7 +3350,8 @@ bool FunctionDecl::isMSVCRTEntryPoint() const {
33503350
// semantic analysis for these functions remains the same.
33513351

33523352
// MSVCRT entry points only exist on MSVCRT targets.
3353-
if (!TUnit->getASTContext().getTargetInfo().getTriple().isOSMSVCRT())
3353+
if (!TUnit->getASTContext().getTargetInfo().getTriple().isOSMSVCRT() &&
3354+
!TUnit->getASTContext().getTargetInfo().getTriple().isUEFI())
33543355
return false;
33553356

33563357
// Nameless functions like constructors cannot be entry points.

clang/lib/AST/DeclPrinter.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1827,7 +1827,7 @@ void DeclPrinter::VisitOMPAllocateDecl(OMPAllocateDecl *D) {
18271827
Out << ")";
18281828
}
18291829
if (!D->clauselist_empty()) {
1830-
OMPClausePrinter Printer(Out, Policy);
1830+
OMPClausePrinter Printer(Out, Policy, Context.getLangOpts().OpenMP);
18311831
for (OMPClause *C : D->clauselists()) {
18321832
Out << " ";
18331833
Printer.Visit(C);
@@ -1838,7 +1838,7 @@ void DeclPrinter::VisitOMPAllocateDecl(OMPAllocateDecl *D) {
18381838
void DeclPrinter::VisitOMPRequiresDecl(OMPRequiresDecl *D) {
18391839
Out << "#pragma omp requires ";
18401840
if (!D->clauselist_empty()) {
1841-
OMPClausePrinter Printer(Out, Policy);
1841+
OMPClausePrinter Printer(Out, Policy, Context.getLangOpts().OpenMP);
18421842
for (auto I = D->clauselist_begin(), E = D->clauselist_end(); I != E; ++I)
18431843
Printer.Visit(*I);
18441844
}
@@ -1891,7 +1891,7 @@ void DeclPrinter::VisitOMPDeclareMapperDecl(OMPDeclareMapperDecl *D) {
18911891
Out << D->getVarName();
18921892
Out << ")";
18931893
if (!D->clauselist_empty()) {
1894-
OMPClausePrinter Printer(Out, Policy);
1894+
OMPClausePrinter Printer(Out, Policy, Context.getLangOpts().OpenMP);
18951895
for (auto *C : D->clauselists()) {
18961896
Out << " ";
18971897
Printer.Visit(C);

clang/lib/AST/Expr.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2247,6 +2247,16 @@ bool BinaryOperator::isNullPointerArithmeticExtension(ASTContext &Ctx,
22472247
return false;
22482248
}
22492249

2250+
// Workaround for old glibc's __PTR_ALIGN macro
2251+
if (auto *Select =
2252+
dyn_cast<ConditionalOperator>(PExp->IgnoreParenNoopCasts(Ctx))) {
2253+
// If the condition can be constant evaluated, we check the selected arm.
2254+
bool EvalResult;
2255+
if (!Select->getCond()->EvaluateAsBooleanCondition(EvalResult, Ctx))
2256+
return false;
2257+
PExp = EvalResult ? Select->getTrueExpr() : Select->getFalseExpr();
2258+
}
2259+
22502260
// Check that the pointer is a nullptr.
22512261
if (!PExp->IgnoreParenCasts()
22522262
->isNullPointerConstant(Ctx, Expr::NPC_ValueDependentIsNotNull))

clang/lib/AST/OpenMPClause.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1821,7 +1821,7 @@ OMPThreadLimitClause *OMPThreadLimitClause::CreateEmpty(const ASTContext &C,
18211821
void OMPClausePrinter::VisitOMPIfClause(OMPIfClause *Node) {
18221822
OS << "if(";
18231823
if (Node->getNameModifier() != OMPD_unknown)
1824-
OS << getOpenMPDirectiveName(Node->getNameModifier()) << ": ";
1824+
OS << getOpenMPDirectiveName(Node->getNameModifier(), Version) << ": ";
18251825
Node->getCondition()->printPretty(OS, nullptr, Policy, 0);
18261826
OS << ")";
18271827
}
@@ -2049,7 +2049,7 @@ void OMPClausePrinter::VisitOMPAbsentClause(OMPAbsentClause *Node) {
20492049
for (auto &D : Node->getDirectiveKinds()) {
20502050
if (!First)
20512051
OS << ", ";
2052-
OS << getOpenMPDirectiveName(D);
2052+
OS << getOpenMPDirectiveName(D, Version);
20532053
First = false;
20542054
}
20552055
OS << ")";
@@ -2067,7 +2067,7 @@ void OMPClausePrinter::VisitOMPContainsClause(OMPContainsClause *Node) {
20672067
for (auto &D : Node->getDirectiveKinds()) {
20682068
if (!First)
20692069
OS << ", ";
2070-
OS << getOpenMPDirectiveName(D);
2070+
OS << getOpenMPDirectiveName(D, Version);
20712071
First = false;
20722072
}
20732073
OS << ")";

clang/lib/AST/StmtPrinter.cpp

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -737,7 +737,9 @@ void StmtPrinter::VisitOMPCanonicalLoop(OMPCanonicalLoop *Node) {
737737

738738
void StmtPrinter::PrintOMPExecutableDirective(OMPExecutableDirective *S,
739739
bool ForceNoStmt) {
740-
OMPClausePrinter Printer(OS, Policy);
740+
unsigned OpenMPVersion =
741+
Context ? Context->getLangOpts().OpenMP : llvm::omp::FallbackVersion;
742+
OMPClausePrinter Printer(OS, Policy, OpenMPVersion);
741743
ArrayRef<OMPClause *> Clauses = S->clauses();
742744
for (auto *Clause : Clauses)
743745
if (Clause && !Clause->isImplicit()) {
@@ -964,14 +966,18 @@ void StmtPrinter::VisitOMPTeamsDirective(OMPTeamsDirective *Node) {
964966

965967
void StmtPrinter::VisitOMPCancellationPointDirective(
966968
OMPCancellationPointDirective *Node) {
969+
unsigned OpenMPVersion =
970+
Context ? Context->getLangOpts().OpenMP : llvm::omp::FallbackVersion;
967971
Indent() << "#pragma omp cancellation point "
968-
<< getOpenMPDirectiveName(Node->getCancelRegion());
972+
<< getOpenMPDirectiveName(Node->getCancelRegion(), OpenMPVersion);
969973
PrintOMPExecutableDirective(Node);
970974
}
971975

972976
void StmtPrinter::VisitOMPCancelDirective(OMPCancelDirective *Node) {
977+
unsigned OpenMPVersion =
978+
Context ? Context->getLangOpts().OpenMP : llvm::omp::FallbackVersion;
973979
Indent() << "#pragma omp cancel "
974-
<< getOpenMPDirectiveName(Node->getCancelRegion());
980+
<< getOpenMPDirectiveName(Node->getCancelRegion(), OpenMPVersion);
975981
PrintOMPExecutableDirective(Node);
976982
}
977983

clang/lib/Basic/OpenMPKinds.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -850,7 +850,8 @@ void clang::getOpenMPCaptureRegions(
850850
case OMPD_master:
851851
return false;
852852
default:
853-
llvm::errs() << getOpenMPDirectiveName(LKind) << '\n';
853+
llvm::errs() << getOpenMPDirectiveName(LKind, llvm::omp::FallbackVersion)
854+
<< '\n';
854855
llvm_unreachable("Unexpected directive");
855856
}
856857
return false;

clang/lib/CIR/CodeGen/CIRGenFunction.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -718,6 +718,12 @@ class CIRGenFunction : public CIRGenTypeCache {
718718
SourceLocation dirLoc, llvm::ArrayRef<const OpenACCClause *> clauses,
719719
const Stmt *associatedStmt);
720720

721+
template <typename Op, typename TermOp>
722+
mlir::LogicalResult emitOpenACCOpCombinedConstruct(
723+
mlir::Location start, mlir::Location end, OpenACCDirectiveKind dirKind,
724+
SourceLocation dirLoc, llvm::ArrayRef<const OpenACCClause *> clauses,
725+
const Stmt *loopStmt);
726+
721727
public:
722728
mlir::LogicalResult
723729
emitOpenACCComputeConstruct(const OpenACCComputeConstruct &s);

0 commit comments

Comments
 (0)