Skip to content

Commit 8ddbf09

Browse files
SC llvm teamSC llvm team
authored andcommitted
Merge upstream LLVM into amd-gfx12
2 parents b6799e4 + 309bb1e commit 8ddbf09

File tree

101 files changed

+4009
-984
lines changed

Some content is hidden

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

101 files changed

+4009
-984
lines changed

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

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,16 @@ RUN regsvr32 /S "C:\BuildTools\DIA SDK\bin\amd64\msdia140.dll" & \
3939

4040
# install tools as described in https://llvm.org/docs/GettingStartedVS.html
4141
# and a few more that were not documented...
42-
RUN choco install -y ninja git sccache
4342
# Pin an older version of Python; the current Python 3.10 fails when
4443
# doing "pip install" for the other dependencies, as it fails to find libxml
4544
# while compiling some package.
46-
RUN choco install -y python3 --version 3.9.7
45+
# We version pin the other packages as well to ensure the container build is as
46+
# reproducible as possible to prevent issues when upgrading only part of the
47+
# container.
48+
RUN choco install -y ninja --version 1.13.1 && \
49+
choco install -y git --version 2.50.1 && \
50+
choco install -y sccache --version 0.10.0 && \
51+
choco install -y python3 --version 3.9.7
4752

4853
# Testing requires psutil
4954
RUN pip install psutil

clang-tools-extra/clang-tidy/misc/ConfusableTable/confusables.txt

Lines changed: 71 additions & 24 deletions
Large diffs are not rendered by default.

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

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2642,6 +2642,36 @@ def ComplexRealPtrOp : CIR_Op<"complex.real_ptr", [Pure]> {
26422642
let hasVerifier = 1;
26432643
}
26442644

2645+
//===----------------------------------------------------------------------===//
2646+
// ComplexImagPtrOp
2647+
//===----------------------------------------------------------------------===//
2648+
2649+
def ComplexImagPtrOp : CIR_Op<"complex.imag_ptr", [Pure]> {
2650+
let summary = "Derive a pointer to the imaginary part of a complex value";
2651+
let description = [{
2652+
`cir.complex.imag_ptr` operation takes a pointer operand that points to a
2653+
complex value of type `!cir.complex` and yields a pointer to the imaginary
2654+
part of the operand.
2655+
2656+
Example:
2657+
2658+
```mlir
2659+
%1 = cir.complex.imag_ptr %0 : !cir.ptr<!cir.complex<!cir.double>>
2660+
-> !cir.ptr<!cir.double>
2661+
```
2662+
}];
2663+
2664+
let arguments = (ins CIR_PtrToComplexType:$operand);
2665+
let results = (outs CIR_PtrToIntOrFloatType:$result);
2666+
2667+
let assemblyFormat = [{
2668+
$operand `:`
2669+
qualified(type($operand)) `->` qualified(type($result)) attr-dict
2670+
}];
2671+
2672+
let hasVerifier = 1;
2673+
}
2674+
26452675
//===----------------------------------------------------------------------===//
26462676
// ComplexAddOp
26472677
//===----------------------------------------------------------------------===//

clang/include/clang/CIR/MissingFeatures.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,10 @@ struct MissingFeatures {
250250
static bool typeChecks() { return false; }
251251
static bool weakRefReference() { return false; }
252252
static bool writebacks() { return false; }
253+
static bool appleKext() { return false; }
254+
static bool dtorCleanups() { return false; }
255+
static bool completeDtors() { return false; }
256+
static bool vtableInitialization() { return false; }
253257

254258
// Missing types
255259
static bool dataMemberType() { return false; }

clang/lib/AST/ASTDiagnostic.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -582,7 +582,7 @@ class TemplateDiff {
582582
/// IsBold - Keeps track of the bold formatting for the output string.
583583
bool IsBold;
584584

585-
/// DiffTree - A tree representation the differences between two types.
585+
/// DiffTree - A tree representation of the differences between two types.
586586
class DiffTree {
587587
public:
588588
/// DiffKind - The difference in a DiffNode. Fields of
@@ -802,7 +802,7 @@ class TemplateDiff {
802802
CurrentNode = FlatTree[CurrentNode].ParentNode;
803803
}
804804

805-
/// AddNode - Adds a child node to the current node, then sets that node
805+
/// AddNode - Adds a child node to the current node, then sets that
806806
/// node as the current node.
807807
void AddNode() {
808808
assert(FlatTree[CurrentNode].Kind == Template &&
@@ -937,12 +937,12 @@ class TemplateDiff {
937937
return FlatTree[ReadNode].ToArgInfo.IsDefault;
938938
}
939939

940-
/// NodeIsSame - Returns true the arguments are the same.
940+
/// NodeIsSame - Returns true if the arguments are the same.
941941
bool NodeIsSame() {
942942
return FlatTree[ReadNode].Same;
943943
}
944944

945-
/// HasChildrend - Returns true if the node has children.
945+
/// HasChildren - Returns true if the node has children.
946946
bool HasChildren() {
947947
return FlatTree[ReadNode].ChildNode != 0;
948948
}
@@ -982,7 +982,7 @@ class TemplateDiff {
982982

983983
/// TSTiterator - a pair of iterators that walks the
984984
/// TemplateSpecializationType and the desugared TemplateSpecializationType.
985-
/// The deseguared TemplateArgument should provide the canonical argument
985+
/// The desugared TemplateArgument should provide the canonical argument
986986
/// for comparisons.
987987
class TSTiterator {
988988
typedef const TemplateArgument& reference;
@@ -993,7 +993,7 @@ class TemplateDiff {
993993
/// parameter packs in order with the rest of the TemplateArguments.
994994
struct InternalIterator {
995995
/// TST - the template specialization whose arguments this iterator
996-
/// traverse over.
996+
/// traverses over.
997997
const TemplateSpecializationType *TST;
998998

999999
/// Index - the index of the template argument in TST.

clang/lib/CIR/CodeGen/CIRGenBuilder.h

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -378,6 +378,21 @@ class CIRGenBuilderTy : public cir::CIRBaseBuilderTy {
378378
addr.getAlignment()};
379379
}
380380

381+
/// Create a cir.complex.imag_ptr operation that derives a pointer to the
382+
/// imaginary part of the complex value pointed to by the specified pointer
383+
/// value.
384+
mlir::Value createComplexImagPtr(mlir::Location loc, mlir::Value value) {
385+
auto srcPtrTy = mlir::cast<cir::PointerType>(value.getType());
386+
auto srcComplexTy = mlir::cast<cir::ComplexType>(srcPtrTy.getPointee());
387+
return create<cir::ComplexImagPtrOp>(
388+
loc, getPointerTo(srcComplexTy.getElementType()), value);
389+
}
390+
391+
Address createComplexImagPtr(mlir::Location loc, Address addr) {
392+
return Address{createComplexImagPtr(loc, addr.getPointer()),
393+
addr.getAlignment()};
394+
}
395+
381396
/// Create a cir.ptr_stride operation to get access to an array element.
382397
/// \p idx is the index of the element to access, \p shouldDecay is true if
383398
/// the result should decay to a pointer to the element type.

clang/lib/CIR/CodeGen/CIRGenCXXABI.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,13 @@ void CIRGenCXXABI::buildThisParam(CIRGenFunction &cgf,
4141
assert(!cir::MissingFeatures::cxxabiThisAlignment());
4242
}
4343

44+
cir::GlobalLinkageKind CIRGenCXXABI::getCXXDestructorLinkage(
45+
GVALinkage linkage, const CXXDestructorDecl *dtor, CXXDtorType dt) const {
46+
// Delegate back to cgm by default.
47+
return cgm.getCIRLinkageForDeclarator(dtor, linkage,
48+
/*isConstantVariable=*/false);
49+
}
50+
4451
mlir::Value CIRGenCXXABI::loadIncomingCXXThis(CIRGenFunction &cgf) {
4552
ImplicitParamDecl *vd = getThisDecl(cgf);
4653
Address addr = cgf.getAddrOfLocalVar(vd);

clang/lib/CIR/CodeGen/CIRGenCXXABI.h

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,19 @@ class CIRGenCXXABI {
7272
/// Emit constructor variants required by this ABI.
7373
virtual void emitCXXConstructors(const clang::CXXConstructorDecl *d) = 0;
7474

75+
/// Emit dtor variants required by this ABI.
76+
virtual void emitCXXDestructors(const clang::CXXDestructorDecl *d) = 0;
77+
78+
/// Returns true if the given destructor type should be emitted as a linkonce
79+
/// delegating thunk, regardless of whether the dtor is defined in this TU or
80+
/// not.
81+
virtual bool useThunkForDtorVariant(const CXXDestructorDecl *dtor,
82+
CXXDtorType dt) const = 0;
83+
84+
virtual cir::GlobalLinkageKind
85+
getCXXDestructorLinkage(GVALinkage linkage, const CXXDestructorDecl *dtor,
86+
CXXDtorType dt) const;
87+
7588
/// Returns true if the given constructor or destructor is one of the kinds
7689
/// that the ABI says returns 'this' (only applies when called non-virtually
7790
/// for destructors).

clang/lib/CIR/CodeGen/CIRGenExpr.cpp

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -637,11 +637,6 @@ LValue CIRGenFunction::emitUnaryOpLValue(const UnaryOperator *e) {
637637
}
638638
case UO_Real:
639639
case UO_Imag: {
640-
if (op == UO_Imag) {
641-
cgm.errorNYI(e->getSourceRange(), "UnaryOp real/imag");
642-
return LValue();
643-
}
644-
645640
LValue lv = emitLValue(e->getSubExpr());
646641
assert(lv.isSimple() && "real/imag on non-ordinary l-value");
647642

@@ -656,7 +651,10 @@ LValue CIRGenFunction::emitUnaryOpLValue(const UnaryOperator *e) {
656651
QualType exprTy = getContext().getCanonicalType(e->getSubExpr()->getType());
657652
QualType elemTy = exprTy->castAs<clang::ComplexType>()->getElementType();
658653
mlir::Location loc = getLoc(e->getExprLoc());
659-
Address component = builder.createComplexRealPtr(loc, lv.getAddress());
654+
Address component =
655+
e->getOpcode() == UO_Real
656+
? builder.createComplexRealPtr(loc, lv.getAddress())
657+
: builder.createComplexImagPtr(loc, lv.getAddress());
660658
assert(!cir::MissingFeatures::opTBAA());
661659
LValue elemLV = makeAddrLValue(component, elemTy);
662660
elemLV.getQuals().addQualifiers(lv.getQuals());

clang/lib/CIR/CodeGen/CIRGenExprScalar.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -520,12 +520,10 @@ class ScalarExprEmitter : public StmtVisitor<ScalarExprEmitter, mlir::Value> {
520520
cgf, cgf.getLoc(e->getSourceRange())};
521521

522522
// Store the updated result through the lvalue
523-
if (lv.isBitField()) {
524-
cgf.cgm.errorNYI(e->getSourceRange(), "Unary inc/dec bitfield");
525-
return {};
526-
} else {
523+
if (lv.isBitField())
524+
return cgf.emitStoreThroughBitfieldLValue(RValue::get(value), lv);
525+
else
527526
cgf.emitStoreThroughLValue(RValue::get(value), lv);
528-
}
529527

530528
// If this is a postinc, return the value read from memory, otherwise use
531529
// the updated value.

0 commit comments

Comments
 (0)