Skip to content

Commit 14e6590

Browse files
authored
merge main into amd-staging (llvm#1742)
2 parents e5eb725 + 1096c0c commit 14e6590

File tree

127 files changed

+5143
-2975
lines changed

Some content is hidden

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

127 files changed

+5143
-2975
lines changed

clang/include/clang/Basic/OpenMPKinds.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -411,9 +411,11 @@ bool isOpenMPCapturingDirective(OpenMPDirectiveKind DKind);
411411
/// directive that can be nested within region corresponding to construct
412412
/// on which order clause was specified with concurrent as ordering argument.
413413
/// \param DKind Specified directive.
414+
/// \param LangOpts Used for getting the OpenMP version.
414415
/// \return true - if the above condition is met for this directive
415416
/// otherwise - false.
416-
bool isOpenMPOrderConcurrentNestableDirective(OpenMPDirectiveKind DKind);
417+
bool isOpenMPOrderConcurrentNestableDirective(OpenMPDirectiveKind DKind,
418+
const LangOptions &LangOpts);
417419
}
418420

419421
template <>
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
//===----------------------------------------------------------------------===//
2+
//
3+
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4+
// See https://llvm.org/LICENSE.txt for license information.
5+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6+
//
7+
//===----------------------------------------------------------------------===//
8+
// Provides an LLVM-like API wrapper to DLTI and MLIR layout queries. This
9+
// makes it easier to port some of LLVM codegen layout logic to CIR.
10+
//===----------------------------------------------------------------------===//
11+
12+
#ifndef CLANG_CIR_DIALECT_IR_CIRDATALAYOUT_H
13+
#define CLANG_CIR_DIALECT_IR_CIRDATALAYOUT_H
14+
15+
#include "mlir/IR/BuiltinOps.h"
16+
17+
namespace cir {
18+
19+
// TODO(cir): This might be replaced by a CIRDataLayout interface which can
20+
// provide the same functionalities.
21+
class CIRDataLayout {
22+
// This is starting with the minimum functionality needed for code that is
23+
// being upstreamed. Additional methods and members will be added as needed.
24+
public:
25+
mlir::DataLayout layout;
26+
27+
/// Constructs a DataLayout the module's data layout attribute.
28+
CIRDataLayout(mlir::ModuleOp modOp) : layout{modOp} {}
29+
};
30+
31+
} // namespace cir
32+
33+
#endif // CLANG_CIR_DIALECT_IR_CIRDATALAYOUT_H

clang/include/clang/CIR/Dialect/IR/CIRTypes.td

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -502,6 +502,11 @@ def CIR_RecordType : CIR_Type<"Record", "record",
502502

503503
void complete(llvm::ArrayRef<mlir::Type> members, bool packed,
504504
bool isPadded);
505+
506+
private:
507+
unsigned computeStructSize(const mlir::DataLayout &dataLayout) const;
508+
uint64_t computeStructAlignment(const mlir::DataLayout &dataLayout) const;
509+
public:
505510
}];
506511

507512
let hasCustomAssemblyFormat = 1;

clang/include/clang/CIR/MissingFeatures.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,13 +102,10 @@ struct MissingFeatures {
102102
static bool shouldReverseUnaryCondOnBoolExpr() { return false; }
103103

104104
// RecordType
105-
static bool recordTypeLayoutInfo() { return false; }
106105
static bool recursiveRecordLayout() { return false; }
107106
static bool skippedLayout() { return false; }
108107
static bool astRecordDeclAttr() { return false; }
109108
static bool cxxSupport() { return false; }
110-
static bool packedRecords() { return false; }
111-
static bool recordPadding() { return false; }
112109
static bool recordZeroInit() { return false; }
113110
static bool zeroSizeRecordMembers() { return false; }
114111

clang/include/clang/Tooling/DependencyScanning/DependencyScanningFilesystem.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,14 @@ class DependencyScanningFilesystemSharedCache {
220220
CacheShard &getShardForFilename(StringRef Filename) const;
221221
CacheShard &getShardForUID(llvm::sys::fs::UniqueID UID) const;
222222

223+
/// Visits all cached entries and re-stat an entry using FS if
224+
/// it is negatively stat cached. If re-stat succeeds on a path,
225+
/// the path is added to InvalidPaths, indicating that the cache
226+
/// may have erroneously negatively cached it. The caller can then
227+
/// use InvalidPaths to issue diagnostics.
228+
std::vector<StringRef>
229+
getInvalidNegativeStatCachedPaths(llvm::vfs::FileSystem &UnderlyingFS) const;
230+
223231
private:
224232
std::unique_ptr<CacheShard[]> CacheShards;
225233
unsigned NumShards;

clang/lib/Basic/OpenMPKinds.cpp

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -768,9 +768,20 @@ bool clang::isOpenMPCapturingDirective(OpenMPDirectiveKind DKind) {
768768
}
769769

770770
bool clang::isOpenMPOrderConcurrentNestableDirective(
771-
OpenMPDirectiveKind DKind) {
772-
return DKind == OMPD_atomic || DKind == OMPD_loop || DKind == OMPD_simd ||
773-
DKind == OMPD_parallel || isOpenMPLoopTransformationDirective(DKind);
771+
OpenMPDirectiveKind DKind, const LangOptions &LangOpts) {
772+
// Directives strictly nestable in a construct with order(concurrent) are:
773+
// OpenMP 5.x: loop, parallel, simd, combined directive starting with parallel
774+
// OpenMP 6.0: above plus atomic and all loop-transformation directives
775+
776+
if (DKind == OMPD_loop || DKind == OMPD_parallel || DKind == OMPD_simd ||
777+
isOpenMPCombinedParallelADirective(DKind))
778+
return true;
779+
780+
if (LangOpts.OpenMP >= 60)
781+
return DKind == OMPD_atomic ||
782+
isOpenMPLoopTransformationDirective(DKind);
783+
784+
return false;
774785
}
775786

776787
void clang::getOpenMPCaptureRegions(

clang/lib/CIR/CodeGen/CIRGenDecl.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,14 @@ void CIRGenFunction::emitDecl(const Decl &d) {
276276
case Decl::OpenACCRoutine:
277277
emitOpenACCRoutine(cast<OpenACCRoutineDecl>(d));
278278
return;
279+
case Decl::Typedef: // typedef int X;
280+
case Decl::TypeAlias: { // using X = int; [C++0x]
281+
QualType ty = cast<TypedefNameDecl>(d).getUnderlyingType();
282+
assert(!cir::MissingFeatures::generateDebugInfo());
283+
if (ty->isVariablyModifiedType())
284+
cgm.errorNYI(d.getSourceRange(), "emitDecl: variably modified type");
285+
return;
286+
}
279287
default:
280288
cgm.errorNYI(d.getSourceRange(),
281289
std::string("emitDecl: unhandled decl type: ") +

clang/lib/CIR/CodeGen/CIRGenExprScalar.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,8 @@ class ScalarExprEmitter : public StmtVisitor<ScalarExprEmitter, mlir::Value> {
116116
return {};
117117
}
118118

119+
mlir::Value VisitParenExpr(ParenExpr *pe) { return Visit(pe->getSubExpr()); }
120+
119121
/// Emits the address of the l-value, then loads and returns the result.
120122
mlir::Value emitLoadOfLValue(const Expr *e) {
121123
LValue lv = cgf.emitLValue(e);

clang/lib/CIR/CodeGen/CIRGenFunction.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -515,6 +515,8 @@ LValue CIRGenFunction::emitLValue(const Expr *e) {
515515
return emitUnaryOpLValue(cast<UnaryOperator>(e));
516516
case Expr::BinaryOperatorClass:
517517
return emitBinaryOperatorLValue(cast<BinaryOperator>(e));
518+
case Expr::ParenExprClass:
519+
return emitLValue(cast<ParenExpr>(e)->getSubExpr());
518520
case Expr::DeclRefExprClass:
519521
return emitDeclRefLValue(cast<DeclRefExpr>(e));
520522
}

clang/lib/CIR/CodeGen/CIRGenModule.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -618,6 +618,8 @@ void CIRGenModule::emitTopLevelDecl(Decl *decl) {
618618
emitGlobalOpenACCDecl(cast<OpenACCDeclareDecl>(decl));
619619
break;
620620

621+
case Decl::Typedef:
622+
case Decl::TypeAlias: // using foo = bar; [C++11]
621623
case Decl::Record:
622624
case Decl::CXXRecord:
623625
assert(!cir::MissingFeatures::generateDebugInfo());

0 commit comments

Comments
 (0)