Skip to content

Commit 5b28b16

Browse files
committed
Merge remote-tracking branch 'origin/main' into vplan-simplify-branch-on-const-entry
2 parents 0006272 + 018dc1b commit 5b28b16

File tree

441 files changed

+11008
-3657
lines changed

Some content is hidden

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

441 files changed

+11008
-3657
lines changed

bolt/lib/Target/AArch64/AArch64MCPlusBuilder.cpp

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2517,10 +2517,8 @@ class AArch64MCPlusBuilder : public MCPlusBuilder {
25172517
createInstrIncMemory(const MCSymbol *Target, MCContext *Ctx, bool IsLeaf,
25182518
unsigned CodePointerSize) const override {
25192519
unsigned int I = 0;
2520-
InstructionListType Instrs(IsLeaf ? 12 : 10);
2520+
InstructionListType Instrs(10);
25212521

2522-
if (IsLeaf)
2523-
createStackPointerIncrement(Instrs[I++], 128);
25242522
createPushRegisters(Instrs[I++], AArch64::X0, AArch64::X1);
25252523
getSystemFlag(Instrs[I++], AArch64::X1);
25262524
InstructionListType Addr = materializeAddress(Target, Ctx, AArch64::X0);
@@ -2535,8 +2533,6 @@ class AArch64MCPlusBuilder : public MCPlusBuilder {
25352533
loadReg(Instrs[I++], AArch64::X2, AArch64::SP);
25362534
setSystemFlag(Instrs[I++], AArch64::X1);
25372535
createPopRegisters(Instrs[I++], AArch64::X0, AArch64::X1);
2538-
if (IsLeaf)
2539-
createStackPointerDecrement(Instrs[I++], 128);
25402536
return Instrs;
25412537
}
25422538

clang/include/clang/Basic/AttrDocs.td

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3752,45 +3752,45 @@ functions intended for different purposes have distinct CFI identities.
37523752

37533753
// Header file - define convenience macros
37543754
#define __cfi_salt(s) __attribute__((cfi_salt(s)))
3755-
3755+
37563756
// Typedef for regular function pointers
37573757
typedef int (*fptr_t)(void);
3758-
3759-
// Typedef for salted function pointers
3758+
3759+
// Typedef for salted function pointers
37603760
typedef int (*fptr_salted_t)(void) __cfi_salt("pepper");
3761-
3761+
37623762
struct widget_ops {
37633763
fptr_t init; // Regular CFI
37643764
fptr_salted_t exec; // Salted CFI
37653765
fptr_t cleanup; // Regular CFI
37663766
};
3767-
3767+
37683768
// Function implementations
37693769
static int widget_init(void) { return 0; }
37703770
static int widget_exec(void) __cfi_salt("pepper") { return 1; }
37713771
static int widget_cleanup(void) { return 0; }
3772-
3772+
37733773
static struct widget_ops ops = {
37743774
.init = widget_init, // OK - compatible types
37753775
.exec = widget_exec, // OK - both use "pepper" salt
37763776
.cleanup = widget_cleanup // OK - compatible types
37773777
};
3778-
3778+
37793779
// Using C++11 attribute syntax
37803780
void secure_callback(void) [[clang::cfi_salt("secure")]];
3781-
3781+
37823782
// This would cause a compilation error:
37833783
// fptr_t bad_ptr = widget_exec; // Error: incompatible types
37843784

37853785
**Notes:**
37863786

37873787
* The salt string can contain non-NULL ASCII characters, including spaces and
37883788
quotes
3789-
* This attribute only applies to function types; using it on non-function
3789+
* This attribute only applies to function types; using it on non-function
37903790
types will generate a warning
3791-
* All declarations and definitions of the same function must use identical
3791+
* All declarations and definitions of the same function must use identical
37923792
salt values
3793-
* The attribute affects type compatibility during compilation and CFI hash
3793+
* The attribute affects type compatibility during compilation and CFI hash
37943794
generation during code generation
37953795
}];
37963796
}

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

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,18 @@ class CIRDataLayout {
6868
return llvm::alignTo(getTypeStoreSize(ty), getABITypeAlign(ty).value());
6969
}
7070

71+
/// Returns the offset in bits between successive objects of the
72+
/// specified type, including alignment padding; always a multiple of 8.
73+
///
74+
/// If Ty is a scalable vector type, the scalable property will be set and
75+
/// the runtime size will be a positive integer multiple of the base size.
76+
///
77+
/// This is the amount that alloca reserves for this type. For example,
78+
/// returns 96 or 128 for x86_fp80, depending on alignment.
79+
llvm::TypeSize getTypeAllocSizeInBits(mlir::Type ty) const {
80+
return 8 * getTypeAllocSize(ty);
81+
}
82+
7183
llvm::TypeSize getTypeSizeInBits(mlir::Type ty) const;
7284
};
7385

clang/include/clang/CIR/MissingFeatures.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,6 @@ struct MissingFeatures {
146146
static bool cxxabiUseARMMethodPtrABI() { return false; }
147147
static bool cxxabiUseARMGuardVarABI() { return false; }
148148
static bool cxxabiAppleARM64CXXABI() { return false; }
149-
static bool isDiscreteBitFieldABI() { return false; }
150149

151150
// Address class
152151
static bool addressOffset() { return false; }

clang/include/clang/Sema/Sema.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5363,7 +5363,7 @@ class Sema final : public SemaBase {
53635363
SourceLocation UsingLoc,
53645364
SourceLocation EnumLoc, SourceRange TyLoc,
53655365
const IdentifierInfo &II, ParsedType Ty,
5366-
CXXScopeSpec *SS = nullptr);
5366+
const CXXScopeSpec &SS);
53675367
Decl *ActOnAliasDeclaration(Scope *CurScope, AccessSpecifier AS,
53685368
MultiTemplateParamsArg TemplateParams,
53695369
SourceLocation UsingLoc, UnqualifiedId &Name,

clang/include/clang/StaticAnalyzer/Core/PathSensitive/MemRegion.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1548,8 +1548,8 @@ class MemRegionManager {
15481548
/// a specified FieldDecl. 'superRegion' corresponds to the containing
15491549
/// memory region (which typically represents the memory representing
15501550
/// a structure or class).
1551-
const FieldRegion *getFieldRegion(const FieldDecl *fd,
1552-
const SubRegion* superRegion);
1551+
const FieldRegion *getFieldRegion(const FieldDecl *FD,
1552+
const SubRegion *SuperRegion);
15531553

15541554
const FieldRegion *getFieldRegionWithSuper(const FieldRegion *FR,
15551555
const SubRegion *superRegion) {

clang/lib/AST/ByteCode/Compiler.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4199,8 +4199,7 @@ template <class Emitter> bool Compiler<Emitter>::visit(const Expr *E) {
41994199
return this->discard(E);
42004200

42014201
// Create local variable to hold the return value.
4202-
if (!E->isGLValue() && !E->getType()->isAnyComplexType() &&
4203-
!canClassify(E->getType())) {
4202+
if (!E->isGLValue() && !canClassify(E->getType())) {
42044203
UnsignedOrNone LocalIndex = allocateLocal(E);
42054204
if (!LocalIndex)
42064205
return false;

clang/lib/CIR/CodeGen/CIRGenRecordLayoutBuilder.cpp

Lines changed: 49 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,16 @@ struct CIRRecordLowering final {
108108
// not the primary vbase of some base class.
109109
bool hasOwnStorage(const CXXRecordDecl *decl, const CXXRecordDecl *query);
110110

111+
/// The Microsoft bitfield layout rule allocates discrete storage
112+
/// units of the field's formal type and only combines adjacent
113+
/// fields of the same formal type. We want to emit a layout with
114+
/// these discrete storage units instead of combining them into a
115+
/// continuous run.
116+
bool isDiscreteBitFieldABI() {
117+
return astContext.getTargetInfo().getCXXABI().isMicrosoft() ||
118+
recordDecl->isMsStruct(astContext);
119+
}
120+
111121
CharUnits bitsToCharUnits(uint64_t bitOffset) {
112122
return astContext.toCharUnitsFromBits(bitOffset);
113123
}
@@ -323,7 +333,45 @@ void CIRRecordLowering::fillOutputFields() {
323333
RecordDecl::field_iterator
324334
CIRRecordLowering::accumulateBitFields(RecordDecl::field_iterator field,
325335
RecordDecl::field_iterator fieldEnd) {
326-
assert(!cir::MissingFeatures::isDiscreteBitFieldABI());
336+
if (isDiscreteBitFieldABI()) {
337+
// run stores the first element of the current run of bitfields. fieldEnd is
338+
// used as a special value to note that we don't have a current run. A
339+
// bitfield run is a contiguous collection of bitfields that can be stored
340+
// in the same storage block. Zero-sized bitfields and bitfields that would
341+
// cross an alignment boundary break a run and start a new one.
342+
RecordDecl::field_iterator run = fieldEnd;
343+
// tail is the offset of the first bit off the end of the current run. It's
344+
// used to determine if the ASTRecordLayout is treating these two bitfields
345+
// as contiguous. StartBitOffset is offset of the beginning of the Run.
346+
uint64_t startBitOffset, tail = 0;
347+
for (; field != fieldEnd && field->isBitField(); ++field) {
348+
// Zero-width bitfields end runs.
349+
if (field->isZeroLengthBitField()) {
350+
run = fieldEnd;
351+
continue;
352+
}
353+
uint64_t bitOffset = getFieldBitOffset(*field);
354+
mlir::Type type = cirGenTypes.convertTypeForMem(field->getType());
355+
// If we don't have a run yet, or don't live within the previous run's
356+
// allocated storage then we allocate some storage and start a new run.
357+
if (run == fieldEnd || bitOffset >= tail) {
358+
run = field;
359+
startBitOffset = bitOffset;
360+
tail = startBitOffset + dataLayout.getTypeAllocSizeInBits(type);
361+
// Add the storage member to the record. This must be added to the
362+
// record before the bitfield members so that it gets laid out before
363+
// the bitfields it contains get laid out.
364+
members.push_back(
365+
makeStorageInfo(bitsToCharUnits(startBitOffset), type));
366+
}
367+
// Bitfields get the offset of their storage but come afterward and remain
368+
// there after a stable sort.
369+
members.push_back(MemberInfo(bitsToCharUnits(startBitOffset),
370+
MemberInfo::InfoKind::Field, nullptr,
371+
*field));
372+
}
373+
return field;
374+
}
327375

328376
CharUnits regSize =
329377
bitsToCharUnits(astContext.getTargetInfo().getRegisterWidth());

clang/lib/CodeGen/CGHLSLBuiltins.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -342,10 +342,10 @@ Value *CodeGenFunction::EmitHLSLBuiltinExpr(unsigned BuiltinID,
342342
}
343343
case Builtin::BI__builtin_hlsl_resource_handlefromimplicitbinding: {
344344
llvm::Type *HandleTy = CGM.getTypes().ConvertType(E->getType());
345-
Value *SpaceOp = EmitScalarExpr(E->getArg(1));
346-
Value *RangeOp = EmitScalarExpr(E->getArg(2));
347-
Value *IndexOp = EmitScalarExpr(E->getArg(3));
348-
Value *OrderID = EmitScalarExpr(E->getArg(4));
345+
Value *OrderID = EmitScalarExpr(E->getArg(1));
346+
Value *SpaceOp = EmitScalarExpr(E->getArg(2));
347+
Value *RangeOp = EmitScalarExpr(E->getArg(3));
348+
Value *IndexOp = EmitScalarExpr(E->getArg(4));
349349
Value *Name = EmitScalarExpr(E->getArg(5));
350350
llvm::Intrinsic::ID IntrinsicID =
351351
CGM.getHLSLRuntime().getCreateHandleFromImplicitBindingIntrinsic();

clang/lib/Headers/avx512fintrin.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1463,12 +1463,12 @@ _mm512_mask_mullo_epi32(__m512i __W, __mmask16 __M, __m512i __A, __m512i __B) {
14631463
(__v16si)__W);
14641464
}
14651465

1466-
static __inline__ __m512i __DEFAULT_FN_ATTRS512
1467-
_mm512_mullox_epi64 (__m512i __A, __m512i __B) {
1466+
static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
1467+
_mm512_mullox_epi64(__m512i __A, __m512i __B) {
14681468
return (__m512i) ((__v8du) __A * (__v8du) __B);
14691469
}
14701470

1471-
static __inline__ __m512i __DEFAULT_FN_ATTRS512
1471+
static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
14721472
_mm512_mask_mullox_epi64(__m512i __W, __mmask8 __U, __m512i __A, __m512i __B) {
14731473
return (__m512i)__builtin_ia32_selectq_512((__mmask8)__U,
14741474
(__v8di)_mm512_mullox_epi64(__A, __B),

0 commit comments

Comments
 (0)