Skip to content

Commit 8bbf7e3

Browse files
authored
merge main into amd-staging (llvm#2456)
2 parents 599c294 + 95d91c9 commit 8bbf7e3

File tree

354 files changed

+8254
-5922
lines changed

Some content is hidden

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

354 files changed

+8254
-5922
lines changed

.github/workflows/containers/github-action-ci-windows/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ RUN powershell -Command \
8585
RUN git config --system core.longpaths true & \
8686
git config --global core.autocrlf false
8787
88-
ARG RUNNER_VERSION=2.324.0
88+
ARG RUNNER_VERSION=2.325.0
8989
ENV RUNNER_VERSION=$RUNNER_VERSION
9090
9191
RUN powershell -Command \

.github/workflows/containers/github-action-ci/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ WORKDIR /home/gha
8686

8787
FROM ci-container as ci-container-agent
8888

89-
ENV GITHUB_RUNNER_VERSION=2.324.0
89+
ENV GITHUB_RUNNER_VERSION=2.325.0
9090

9191
RUN mkdir actions-runner && \
9292
cd actions-runner && \

clang/include/clang/Basic/DiagnosticSerializationKinds.td

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,9 @@ def err_fe_ast_file_modified : Error<
2424
DefaultFatal;
2525
def err_fe_pch_file_overridden : Error<
2626
"file '%0' from the precompiled header has been overridden">;
27-
def note_pch_required_by : Note<"'%0' required by '%1'">;
28-
def note_pch_rebuild_required : Note<"please rebuild precompiled header '%0'">;
27+
def note_ast_file_required_by : Note<"'%0' required by '%1'">;
28+
def note_ast_file_rebuild_required
29+
: Note<"please rebuild precompiled file '%0'">;
2930
def note_module_cache_path : Note<
3031
"after modifying system headers, please delete the module cache at '%0'">;
3132

clang/include/clang/CIR/CIRGenerator.h

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,24 +43,49 @@ class CIRGenerator : public clang::ASTConsumer {
4343

4444
const clang::CodeGenOptions &codeGenOpts;
4545

46+
unsigned handlingTopLevelDecls;
47+
48+
/// Use this when emitting decls to block re-entrant decl emission. It will
49+
/// emit all deferred decls on scope exit. Set EmitDeferred to false if decl
50+
/// emission must be deferred longer, like at the end of a tag definition.
51+
struct HandlingTopLevelDeclRAII {
52+
CIRGenerator &self;
53+
bool emitDeferred;
54+
HandlingTopLevelDeclRAII(CIRGenerator &self, bool emitDeferred = true)
55+
: self{self}, emitDeferred{emitDeferred} {
56+
++self.handlingTopLevelDecls;
57+
}
58+
~HandlingTopLevelDeclRAII() {
59+
unsigned Level = --self.handlingTopLevelDecls;
60+
if (Level == 0 && emitDeferred)
61+
self.emitDeferredDecls();
62+
}
63+
};
64+
4665
protected:
4766
std::unique_ptr<mlir::MLIRContext> mlirContext;
4867
std::unique_ptr<clang::CIRGen::CIRGenModule> cgm;
4968

69+
private:
70+
llvm::SmallVector<clang::FunctionDecl *, 8> deferredInlineMemberFuncDefs;
71+
5072
public:
5173
CIRGenerator(clang::DiagnosticsEngine &diags,
5274
llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem> fs,
5375
const clang::CodeGenOptions &cgo);
5476
~CIRGenerator() override;
5577
void Initialize(clang::ASTContext &astContext) override;
5678
bool HandleTopLevelDecl(clang::DeclGroupRef group) override;
79+
void HandleInlineFunctionDefinition(clang::FunctionDecl *d) override;
5780
void CompleteTentativeDefinition(clang::VarDecl *d) override;
5881

5982
mlir::ModuleOp getModule() const;
6083
mlir::MLIRContext &getMLIRContext() { return *mlirContext; };
6184
const mlir::MLIRContext &getMLIRContext() const { return *mlirContext; };
6285

6386
bool verifyModule() const;
87+
88+
void emitDeferredDecls();
6489
};
6590

6691
} // namespace cir

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

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1464,9 +1464,13 @@ def ShiftOp : CIR_Op<"shift", [Pure]> {
14641464
```
14651465
}];
14661466

1467-
let results = (outs CIR_AnyIntOrVecOfInt:$result);
1468-
let arguments = (ins CIR_AnyIntOrVecOfInt:$value, CIR_AnyIntOrVecOfInt:$amount,
1469-
UnitAttr:$isShiftleft);
1467+
let arguments = (ins
1468+
CIR_AnyIntOrVecOfIntType:$value,
1469+
CIR_AnyIntOrVecOfIntType:$amount,
1470+
UnitAttr:$isShiftleft
1471+
);
1472+
1473+
let results = (outs CIR_AnyIntOrVecOfIntType:$result);
14701474

14711475
let assemblyFormat = [{
14721476
`(`
@@ -2050,7 +2054,7 @@ def VecCreateOp : CIR_Op<"vec.create", [Pure]> {
20502054
in the vector type.
20512055
}];
20522056

2053-
let arguments = (ins Variadic<CIR_AnyType>:$elements);
2057+
let arguments = (ins Variadic<CIR_VectorElementType>:$elements);
20542058
let results = (outs CIR_VectorType:$result);
20552059

20562060
let assemblyFormat = [{
@@ -2085,7 +2089,7 @@ def VecInsertOp : CIR_Op<"vec.insert", [Pure,
20852089

20862090
let arguments = (ins
20872091
CIR_VectorType:$vec,
2088-
AnyType:$value,
2092+
CIR_VectorElementType:$value,
20892093
CIR_AnyFundamentalIntType:$index
20902094
);
20912095

@@ -2118,7 +2122,7 @@ def VecExtractOp : CIR_Op<"vec.extract", [Pure,
21182122
}];
21192123

21202124
let arguments = (ins CIR_VectorType:$vec, CIR_AnyFundamentalIntType:$index);
2121-
let results = (outs CIR_AnyType:$result);
2125+
let results = (outs CIR_VectorElementType:$result);
21222126

21232127
let assemblyFormat = [{
21242128
$vec `[` $index `:` type($index) `]` attr-dict `:` qualified(type($vec))
@@ -2180,7 +2184,7 @@ def VecShuffleDynamicOp : CIR_Op<"vec.shuffle.dynamic",
21802184
```
21812185
}];
21822186

2183-
let arguments = (ins CIR_VectorType:$vec, IntegerVector:$indices);
2187+
let arguments = (ins CIR_VectorType:$vec, CIR_VectorOfIntType:$indices);
21842188
let results = (outs CIR_VectorType:$result);
21852189
let assemblyFormat = [{
21862190
$vec `:` qualified(type($vec)) `,` $indices `:` qualified(type($indices))

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

Lines changed: 60 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,18 @@ class CIR_ConfinedType<Type type, list<Pred> preds, string summary = "">
3131
: Type<And<[type.predicate, CIR_CastedSelfsToType<type.cppType, preds>]>,
3232
summary, type.cppType>;
3333

34+
// Generates a type summary.
35+
// - For a single type: returns its summary.
36+
// - For multiple types: returns `any of <comma-separated summaries>`.
37+
class CIR_TypeSummaries<list<Type> types> {
38+
assert !not(!empty(types)), "expects non-empty list of types";
39+
40+
list<string> summaries = !foreach(type, types, type.summary);
41+
string joined = !interleave(summaries, ", ");
42+
43+
string value = !if(!eq(!size(types), 1), joined, "any of " # joined);
44+
}
45+
3446
//===----------------------------------------------------------------------===//
3547
// Bool Type predicates
3648
//===----------------------------------------------------------------------===//
@@ -184,6 +196,24 @@ def CIR_PtrToVoidPtrType
184196
// Vector Type predicates
185197
//===----------------------------------------------------------------------===//
186198

199+
def CIR_AnyVectorType : CIR_TypeBase<"::cir::VectorType", "vector type">;
200+
201+
def CIR_VectorElementType : AnyTypeOf<[CIR_AnyIntOrFloatType, CIR_AnyPtrType],
202+
"any cir integer, floating point or pointer type"
203+
> {
204+
let cppFunctionName = "isValidVectorTypeElementType";
205+
}
206+
207+
class CIR_ElementTypePred<Pred pred> : SubstLeaves<"$_self",
208+
"::mlir::cast<::cir::VectorType>($_self).getElementType()", pred>;
209+
210+
class CIR_VectorTypeOf<list<Type> types, string summary = "">
211+
: CIR_ConfinedType<CIR_AnyVectorType,
212+
[Or<!foreach(type, types, CIR_ElementTypePred<type.predicate>)>],
213+
!if(!empty(summary),
214+
"vector of " # CIR_TypeSummaries<types>.value,
215+
summary)>;
216+
187217
// Vector of integral type
188218
def IntegerVector : Type<
189219
And<[
@@ -196,8 +226,36 @@ def IntegerVector : Type<
196226
]>, "!cir.vector of !cir.int"> {
197227
}
198228

199-
// Any Integer or Vector of Integer Constraints
200-
def CIR_AnyIntOrVecOfInt: AnyTypeOf<[CIR_AnyIntType, IntegerVector]>;
229+
// Vector of type constraints
230+
def CIR_VectorOfIntType : CIR_VectorTypeOf<[CIR_AnyIntType]>;
231+
def CIR_VectorOfUIntType : CIR_VectorTypeOf<[CIR_AnyUIntType]>;
232+
def CIR_VectorOfSIntType : CIR_VectorTypeOf<[CIR_AnySIntType]>;
233+
def CIR_VectorOfFloatType : CIR_VectorTypeOf<[CIR_AnyFloatType]>;
234+
235+
// Vector or Scalar type constraints
236+
def CIR_AnyIntOrVecOfIntType
237+
: AnyTypeOf<[CIR_AnyIntType, CIR_VectorOfIntType],
238+
"integer or vector of integer type"> {
239+
let cppFunctionName = "isIntOrVectorOfIntType";
240+
}
241+
242+
def CIR_AnySIntOrVecOfSIntType
243+
: AnyTypeOf<[CIR_AnySIntType, CIR_VectorOfSIntType],
244+
"signed integer or vector of signed integer type"> {
245+
let cppFunctionName = "isSIntOrVectorOfSIntType";
246+
}
247+
248+
def CIR_AnyUIntOrVecOfUIntType
249+
: AnyTypeOf<[CIR_AnyUIntType, CIR_VectorOfUIntType],
250+
"unsigned integer or vector of unsigned integer type"> {
251+
let cppFunctionName = "isUIntOrVectorOfUIntType";
252+
}
253+
254+
def CIR_AnyFloatOrVecOfFloatType
255+
: AnyTypeOf<[CIR_AnyFloatType, CIR_VectorOfFloatType],
256+
"floating point or vector of floating point type"> {
257+
let cppFunctionName = "isFPOrVectorOfFPType";
258+
}
201259

202260
//===----------------------------------------------------------------------===//
203261
// Scalar Type predicates

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,6 @@ struct RecordTypeStorage;
2626

2727
bool isValidFundamentalIntWidth(unsigned width);
2828

29-
bool isFPOrFPVectorTy(mlir::Type);
30-
3129
} // namespace cir
3230

3331
//===----------------------------------------------------------------------===//

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

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -275,18 +275,31 @@ def CIR_VectorType : CIR_Type<"Vector", "vector",
275275

276276
let summary = "CIR vector type";
277277
let description = [{
278-
`!cir.vector' represents fixed-size vector types, parameterized
279-
by the element type and the number of elements.
278+
The `!cir.vector` type represents a fixed-size, one-dimensional vector.
279+
It takes two parameters: the element type and the number of elements.
280280

281-
Example:
281+
Syntax:
282282

283283
```mlir
284-
!cir.vector<!u64i x 2>
285-
!cir.vector<!cir.float x 4>
284+
vector-type ::= !cir.vector<size x element-type>
285+
element-type ::= float-type | integer-type | pointer-type
286+
```
287+
288+
The `element-type` must be a scalar CIR type. Zero-sized vectors are not
289+
allowed. The `size` must be a positive integer.
290+
291+
Examples:
292+
293+
```mlir
294+
!cir.vector<4 x !cir.int<u, 8>>
295+
!cir.vector<2 x !cir.float>
286296
```
287297
}];
288298

289-
let parameters = (ins "mlir::Type":$elementType, "uint64_t":$size);
299+
let parameters = (ins
300+
CIR_VectorElementType:$elementType,
301+
"uint64_t":$size
302+
);
290303

291304
let assemblyFormat = [{
292305
`<` $size `x` $elementType `>`

clang/include/clang/CIR/MissingFeatures.h

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,17 +34,18 @@ struct MissingFeatures {
3434
static bool opGlobalThreadLocal() { return false; }
3535
static bool opGlobalConstant() { return false; }
3636
static bool opGlobalWeakRef() { return false; }
37-
static bool opGlobalLinkage() { return false; }
3837
static bool opGlobalUnnamedAddr() { return false; }
3938
static bool opGlobalSection() { return false; }
4039
static bool opGlobalVisibility() { return false; }
4140
static bool opGlobalDLLImportExport() { return false; }
4241
static bool opGlobalPartition() { return false; }
42+
static bool opGlobalUsedOrCompilerUsed() { return false; }
4343

4444
static bool supportIFuncAttr() { return false; }
4545
static bool supportVisibility() { return false; }
4646
static bool hiddenVisibility() { return false; }
4747
static bool protectedVisibility() { return false; }
48+
static bool defaultVisibility() { return false; }
4849

4950
// Load/store attributes
5051
static bool opLoadStoreThreadLocal() { return false; }
@@ -77,6 +78,9 @@ struct MissingFeatures {
7778
static bool opFuncLinkage() { return false; }
7879
static bool opFuncVisibility() { return false; }
7980
static bool opFuncNoProto() { return false; }
81+
static bool opFuncCPUAndFeaturesAttributes() { return false; }
82+
static bool opFuncSection() { return false; }
83+
static bool opFuncSetComdat() { return false; }
8084

8185
// CallOp handling
8286
static bool opCallBuiltinFunc() { return false; }
@@ -133,10 +137,16 @@ struct MissingFeatures {
133137
static bool recordZeroInit() { return false; }
134138
static bool zeroSizeRecordMembers() { return false; }
135139

136-
// Misc
140+
// CXXABI
137141
static bool cxxABI() { return false; }
142+
static bool cxxabiThisAlignment() { return false; }
143+
static bool cxxabiUseARMMethodPtrABI() { return false; }
144+
static bool cxxabiUseARMGuardVarABI() { return false; }
145+
static bool cxxabiAppleARM64CXXABI() { return false; }
146+
static bool cxxabiStructorImplicitParam() { return false; }
147+
148+
// Misc
138149
static bool cirgenABIInfo() { return false; }
139-
static bool cirgenTargetInfo() { return false; }
140150
static bool abiArgInfo() { return false; }
141151
static bool tryEmitAsConstant() { return false; }
142152
static bool constructABIArgDirectExtend() { return false; }
@@ -184,7 +194,6 @@ struct MissingFeatures {
184194
static bool typeChecks() { return false; }
185195
static bool lambdaFieldToName() { return false; }
186196
static bool updateCompletedType() { return false; }
187-
static bool targetSpecificCXXABI() { return false; }
188197
static bool moduleNameHash() { return false; }
189198
static bool constantFoldSwitchStatement() { return false; }
190199
static bool cudaSupport() { return false; }
@@ -193,12 +202,12 @@ struct MissingFeatures {
193202
static bool constEmitterVectorILE() { return false; }
194203
static bool needsGlobalCtorDtor() { return false; }
195204
static bool emitTypeCheck() { return false; }
196-
static bool cxxabiThisDecl() { return false; }
197-
static bool cxxabiThisAlignment() { return false; }
198205
static bool writebacks() { return false; }
199206
static bool cleanupsToDeactivate() { return false; }
200207
static bool stackBase() { return false; }
201208
static bool deferredDecls() { return false; }
209+
static bool setTargetAttributes() { return false; }
210+
static bool coverageMapping() { return false; }
202211

203212
// Missing types
204213
static bool dataMemberType() { return false; }

0 commit comments

Comments
 (0)