Skip to content

Commit 9de3a8c

Browse files
committed
Merge remote-tracking branch 'upstream/main' into gisel-knownbits-rotlr
2 parents c57ff7a + e2d2aff commit 9de3a8c

File tree

245 files changed

+3497
-1579
lines changed

Some content is hidden

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

245 files changed

+3497
-1579
lines changed

.ci/generate_test_report_github.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
import generate_test_report_lib
1010

11+
1112
def compute_platform_title() -> str:
1213
logo = ":window:" if platform.system() == "Windows" else ":penguin:"
1314
# On Linux the machine value is x86_64 on Windows it is AMD64.

.ci/generate_test_report_lib.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ def _format_ninja_failures(ninja_failures: list[tuple[str, str]]) -> list[str]:
100100
)
101101
return output
102102

103+
103104
def get_failures(junit_objects) -> dict[str, list[tuple[str, str]]]:
104105
failures = {}
105106
for results in junit_objects:

bolt/test/runtime/AArch64/inline-memcpy.s

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -81,14 +81,14 @@
8181
# CHECK-ASM: bl{{.*}}<memcpy
8282

8383
# Register move should NOT be inlined (size unknown at compile time)
84-
# CHECK-ASM-LABEL: <test_register_move_negative>:
84+
# CHECK-ASM-LABEL: <test_register_move_unknown>:
8585
# CHECK-ASM: bl{{.*}}<memcpy
8686

87-
# CHECK-ASM-LABEL: <test_x2_rewrite_negative>:
87+
# CHECK-ASM-LABEL: <test_x2_rewrite_unknown>:
8888
# CHECK-ASM: bl{{.*}}<memcpy
8989

9090
# Live-in parameter should NOT be inlined (size unknown at compile time)
91-
# CHECK-ASM-LABEL: <test_live_in_negative>:
91+
# CHECK-ASM-LABEL: <test_live_in_unknown>:
9292
# CHECK-ASM: bl{{.*}}<memcpy
9393

9494
# _memcpy8 should be inlined with end-pointer return (dest+size)
@@ -262,9 +262,9 @@ test_4_byte_add_immediate:
262262
ret
263263
.size test_4_byte_add_immediate, .-test_4_byte_add_immediate
264264

265-
.globl test_register_move_negative
266-
.type test_register_move_negative,@function
267-
test_register_move_negative:
265+
.globl test_register_move_unknown
266+
.type test_register_move_unknown,@function
267+
test_register_move_unknown:
268268
stp x29, x30, [sp, #-32]!
269269
mov x29, sp
270270
add x1, sp, #16
@@ -274,20 +274,20 @@ test_register_move_negative:
274274
bl memcpy
275275
ldp x29, x30, [sp], #32
276276
ret
277-
.size test_register_move_negative, .-test_register_move_negative
277+
.size test_register_move_unknown, .-test_register_move_unknown
278278

279-
.globl test_x2_rewrite_negative
280-
.type test_x2_rewrite_negative,@function
281-
test_x2_rewrite_negative:
279+
.globl test_x2_rewrite_unknown
280+
.type test_x2_rewrite_unknown,@function
281+
test_x2_rewrite_unknown:
282282
mov x2, #8
283283
ldr x2, [sp, #24]
284284
bl memcpy
285285
ret
286-
.size test_x2_rewrite_negative, .-test_x2_rewrite_negative
286+
.size test_x2_rewrite_unknown, .-test_x2_rewrite_unknown
287287

288-
.globl test_live_in_negative
289-
.type test_live_in_negative,@function
290-
test_live_in_negative:
288+
.globl test_live_in_unknown
289+
.type test_live_in_unknown,@function
290+
test_live_in_unknown:
291291
# x2 comes in as parameter, no instruction sets it (should NOT inline)
292292
stp x29, x30, [sp, #-32]!
293293
mov x29, sp
@@ -297,7 +297,7 @@ test_live_in_negative:
297297
bl memcpy
298298
ldp x29, x30, [sp], #32
299299
ret
300-
.size test_live_in_negative, .-test_live_in_negative
300+
.size test_live_in_unknown, .-test_live_in_unknown
301301

302302
.globl test_memcpy8_4_byte
303303
.type test_memcpy8_4_byte,@function

clang-tools-extra/docs/clang-tidy/checks/cert/mem57-cpp.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ cert-mem57-cpp
44
==============
55

66
The `cert-mem57-cpp` is an aliaes, please see
7-
`bugprone-default-operator-new-on-overaligned-type <../bugprone/default-operator-new-on-overaligned-type>`_
7+
`bugprone-default-operator-new-on-overaligned-type <../bugprone/default-operator-new-on-overaligned-type.html>`_
88
for more information.
99

1010
This check corresponds to the CERT C++ Coding Standard rule

clang/include/clang/Basic/AttrDocs.td

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3450,9 +3450,9 @@ Mac, and BSD. This attribute has no effect on other targets.
34503450
def MSABIDocs : Documentation {
34513451
let Category = DocCatCallingConvs;
34523452
let Content = [{
3453-
On non-Windows x86_64 targets, this attribute changes the calling convention of
3454-
a function to match the default convention used on Windows x86_64. This
3455-
attribute has no effect on Windows targets or non-x86_64 targets.
3453+
On non-Windows x86_64 and aarch64 targets, this attribute changes the calling convention of
3454+
a function to match the default convention used on Windows. This
3455+
attribute has no effect on Windows targets or non-x86_64, non-aarch64 targets.
34563456
}];
34573457
}
34583458

clang/include/clang/Basic/BuiltinsAMDGPU.def

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ BUILTIN(__builtin_amdgcn_raw_buffer_load_b128, "V4UiQbiiIi", "n")
180180
BUILTIN(__builtin_amdgcn_raw_ptr_buffer_atomic_add_i32, "iiQbiiIi", "")
181181

182182
TARGET_BUILTIN(__builtin_amdgcn_raw_ptr_buffer_atomic_fadd_f32, "ffQbiiIi", "", "atomic-fadd-rtn-insts")
183-
TARGET_BUILTIN(__builtin_amdgcn_raw_ptr_buffer_atomic_fadd_v2f16, "V2hV2hQbiiIi", "t", "atomic-buffer-global-pk-add-f16-insts")
183+
TARGET_BUILTIN(__builtin_amdgcn_raw_ptr_buffer_atomic_fadd_v2f16, "V2hV2hQbiiIi", "", "atomic-buffer-global-pk-add-f16-insts")
184184

185185
TARGET_BUILTIN(__builtin_amdgcn_raw_ptr_buffer_atomic_fmin_f32, "ffQbiiIi", "", "atomic-fmin-fmax-global-f32")
186186
TARGET_BUILTIN(__builtin_amdgcn_raw_ptr_buffer_atomic_fmax_f32, "ffQbiiIi", "", "atomic-fmin-fmax-global-f32")

clang/include/clang/Basic/IdentifierTable.h

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,57 @@ class LangOptions;
4646
class MultiKeywordSelector;
4747
class SourceLocation;
4848

49+
/// Constants for TokenKinds.def
50+
enum TokenKey : unsigned {
51+
KEYC99 = 0x1,
52+
KEYCXX = 0x2,
53+
KEYCXX11 = 0x4,
54+
KEYGNU = 0x8,
55+
KEYMS = 0x10,
56+
BOOLSUPPORT = 0x20,
57+
KEYALTIVEC = 0x40,
58+
KEYNOCXX = 0x80,
59+
KEYBORLAND = 0x100,
60+
KEYOPENCLC = 0x200,
61+
KEYC23 = 0x400,
62+
KEYNOMS18 = 0x800,
63+
KEYNOOPENCL = 0x1000,
64+
WCHARSUPPORT = 0x2000,
65+
HALFSUPPORT = 0x4000,
66+
CHAR8SUPPORT = 0x8000,
67+
KEYOBJC = 0x10000,
68+
KEYZVECTOR = 0x20000,
69+
KEYCOROUTINES = 0x40000,
70+
KEYMODULES = 0x80000,
71+
KEYCXX20 = 0x100000,
72+
KEYOPENCLCXX = 0x200000,
73+
KEYMSCOMPAT = 0x400000,
74+
KEYSYCL = 0x800000,
75+
KEYCUDA = 0x1000000,
76+
KEYZOS = 0x2000000,
77+
KEYNOZOS = 0x4000000,
78+
KEYHLSL = 0x8000000,
79+
KEYFIXEDPOINT = 0x10000000,
80+
KEYMAX = KEYFIXEDPOINT, // The maximum key
81+
KEYALLCXX = KEYCXX | KEYCXX11 | KEYCXX20,
82+
KEYALL = (KEYMAX | (KEYMAX - 1)) & ~KEYNOMS18 & ~KEYNOOPENCL &
83+
~KEYNOZOS // KEYNOMS18, KEYNOOPENCL, KEYNOZOS are excluded.
84+
};
85+
86+
/// How a keyword is treated in the selected standard. This enum is ordered
87+
/// intentionally so that the value that 'wins' is the most 'permissive'.
88+
enum KeywordStatus {
89+
KS_Unknown, // Not yet calculated. Used when figuring out the status.
90+
KS_Disabled, // Disabled
91+
KS_Future, // Is a keyword in future standard
92+
KS_Extension, // Is an extension
93+
KS_Enabled, // Enabled
94+
};
95+
96+
/// Translates flags as specified in TokenKinds.def into keyword status
97+
/// in the given language standard.
98+
KeywordStatus getKeywordStatus(const LangOptions &LangOpts, unsigned Flags);
99+
49100
enum class ReservedIdentifierStatus {
50101
NotReserved = 0,
51102
StartsWithUnderscoreAtGlobalScope,

clang/include/clang/Sema/Sema.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11668,7 +11668,7 @@ class Sema final : public SemaBase {
1166811668
ASTTemplateArgsPtr TemplateArgsIn, SourceLocation RAngleLoc);
1166911669

1167011670
DeclResult ActOnVarTemplateSpecialization(
11671-
Scope *S, Declarator &D, TypeSourceInfo *DI, LookupResult &Previous,
11671+
Scope *S, Declarator &D, TypeSourceInfo *TSI, LookupResult &Previous,
1167211672
SourceLocation TemplateKWLoc, TemplateParameterList *TemplateParams,
1167311673
StorageClass SC, bool IsPartialSpecialization);
1167411674

clang/lib/AST/ASTContext.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3108,9 +3108,9 @@ TypeSourceInfo *ASTContext::CreateTypeSourceInfo(QualType T,
31083108

31093109
TypeSourceInfo *ASTContext::getTrivialTypeSourceInfo(QualType T,
31103110
SourceLocation L) const {
3111-
TypeSourceInfo *DI = CreateTypeSourceInfo(T);
3112-
DI->getTypeLoc().initialize(const_cast<ASTContext &>(*this), L);
3113-
return DI;
3111+
TypeSourceInfo *TSI = CreateTypeSourceInfo(T);
3112+
TSI->getTypeLoc().initialize(const_cast<ASTContext &>(*this), L);
3113+
return TSI;
31143114
}
31153115

31163116
const ASTRecordLayout &
@@ -5891,11 +5891,11 @@ TypeSourceInfo *ASTContext::getTemplateSpecializationTypeInfo(
58915891
QualType TST = getTemplateSpecializationType(
58925892
Keyword, Name, SpecifiedArgs.arguments(), CanonicalArgs, Underlying);
58935893

5894-
TypeSourceInfo *DI = CreateTypeSourceInfo(TST);
5895-
DI->getTypeLoc().castAs<TemplateSpecializationTypeLoc>().set(
5894+
TypeSourceInfo *TSI = CreateTypeSourceInfo(TST);
5895+
TSI->getTypeLoc().castAs<TemplateSpecializationTypeLoc>().set(
58965896
ElaboratedKeywordLoc, QualifierLoc, TemplateKeywordLoc, NameLoc,
58975897
SpecifiedArgs);
5898-
return DI;
5898+
return TSI;
58995899
}
59005900

59015901
QualType ASTContext::getTemplateSpecializationType(

clang/lib/AST/ByteCode/Compiler.cpp

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,19 @@ template <class Emitter> class LocOverrideScope final {
208208
} // namespace interp
209209
} // namespace clang
210210

211+
template <class Emitter>
212+
bool Compiler<Emitter>::isValidBitCast(const CastExpr *E) {
213+
QualType FromTy = E->getSubExpr()->getType()->getPointeeType();
214+
QualType ToTy = E->getType()->getPointeeType();
215+
216+
if (classify(FromTy) == classify(ToTy))
217+
return true;
218+
219+
if (FromTy->isVoidType() || ToTy->isVoidType())
220+
return true;
221+
return false;
222+
}
223+
211224
template <class Emitter>
212225
bool Compiler<Emitter>::VisitCastExpr(const CastExpr *CE) {
213226
const Expr *SubExpr = CE->getSubExpr();
@@ -476,8 +489,9 @@ bool Compiler<Emitter>::VisitCastExpr(const CastExpr *CE) {
476489
return this->delegate(SubExpr);
477490

478491
case CK_BitCast: {
492+
QualType CETy = CE->getType();
479493
// Reject bitcasts to atomic types.
480-
if (CE->getType()->isAtomicType()) {
494+
if (CETy->isAtomicType()) {
481495
if (!this->discard(SubExpr))
482496
return false;
483497
return this->emitInvalidCast(CastKind::Reinterpret, /*Fatal=*/true, CE);
@@ -492,6 +506,10 @@ bool Compiler<Emitter>::VisitCastExpr(const CastExpr *CE) {
492506
if (!FromT || !ToT)
493507
return false;
494508

509+
if (!this->isValidBitCast(CE) &&
510+
!this->emitInvalidCast(CastKind::ReinterpretLike, /*Fatal=*/false, CE))
511+
return false;
512+
495513
assert(isPtrType(*FromT));
496514
assert(isPtrType(*ToT));
497515
if (FromT == ToT) {

0 commit comments

Comments
 (0)