Skip to content

Commit c5659bd

Browse files
committed
Merge "merge main into amd-staging" into amd-staging
2 parents 6551ef3 + 018b56e commit c5659bd

File tree

270 files changed

+2493
-1294
lines changed

Some content is hidden

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

270 files changed

+2493
-1294
lines changed

bolt/lib/Profile/YAMLProfileReader.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -373,6 +373,7 @@ Error YAMLProfileReader::preprocessProfile(BinaryContext &BC) {
373373
return errorCodeToError(EC);
374374
}
375375
yaml::Input YamlInput(MB.get()->getBuffer());
376+
YamlInput.setAllowUnknownKeys(true);
376377

377378
// Consume YAML file.
378379
YamlInput >> YamlBP;

bolt/test/X86/yaml-unknown-keys.test

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
## Test that BOLT gracefully handles a YAML profile with unknown keys.
2+
3+
# REQUIRES: system-linux
4+
# RUN: split-file %s %t
5+
# RUN: llvm-mc -filetype=obj -triple x86_64-unknown-unknown %t/main.s -o %t.o
6+
# RUN: %clang %cflags %t.o -o %t.exe -Wl,-q -nostdlib
7+
# RUN: llvm-bolt %t.exe -o %t.null --data %t/profile.yaml \
8+
# RUN: --profile-ignore-hash -v=1 2>&1 | FileCheck %s
9+
# CHECK: warning: unknown key 'unknown-header-key'
10+
# CHECK: warning: unknown key 'unknown_succ_key'
11+
# CHECK: warning: unknown key 'unknown_block_key'
12+
# CHECK: warning: unknown key 'unknown_function_key'
13+
# CHECK: warning: unknown key 'unknown_toplev_key'
14+
#--- main.s
15+
.globl main
16+
.type main, %function
17+
main:
18+
.cfi_startproc
19+
cmpl $0x0, %eax
20+
jne .LBB0
21+
.LBB0:
22+
retq
23+
.cfi_endproc
24+
.size main, .-main
25+
#--- profile.yaml
26+
---
27+
header:
28+
profile-version: 1
29+
binary-name: 'yaml-multiple-profiles.test.tmp.exe'
30+
binary-build-id: '<unknown>'
31+
profile-flags: [ lbr ]
32+
profile-origin: branch profile reader
33+
profile-events: ''
34+
dfs-order: false
35+
unknown-header-key: true
36+
functions:
37+
- name: 'main'
38+
fid: 1
39+
hash: 0x50BBA3441D436491
40+
exec: 1
41+
nblocks: 1
42+
blocks:
43+
- bid: 0
44+
insns: 2
45+
hash: 0x4D4D8FAF7D4C0000
46+
succ: [ { bid: 1, cnt: 0, unknown_succ_key: 0x10 } ]
47+
unknown_block_key: [ ]
48+
unknown_function_key: 1
49+
unknown_toplev_key: ''
50+
...

bolt/tools/merge-fdata/merge-fdata.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -392,6 +392,7 @@ int main(int argc, char **argv) {
392392
if (std::error_code EC = MB.getError())
393393
report_error(InputDataFilename, EC);
394394
yaml::Input YamlInput(MB.get()->getBuffer());
395+
YamlInput.setAllowUnknownKeys(true);
395396

396397
errs() << "Merging data from " << InputDataFilename << "...\n";
397398

clang/cmake/caches/Fuchsia-stage2.cmake

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,7 @@ foreach(target aarch64-unknown-linux-gnu;armv7-unknown-linux-gnueabihf;i386-unkn
155155
set(BUILTINS_${target}_CMAKE_MODULE_LINKER_FLAGS "-fuse-ld=lld" CACHE STRING "")
156156
set(BUILTINS_${target}_CMAKE_EXE_LINKER_FLAG "-fuse-ld=lld" CACHE STRING "")
157157
set(BUILTINS_${target}_COMPILER_RT_BUILD_STANDALONE_LIBATOMIC ON CACHE BOOL "")
158+
set(BUILTINS_${target}_COMPILER_RT_LIBATOMIC_USE_PTHREAD ON CACHE BOOL "")
158159

159160
# Set the per-target runtimes options.
160161
list(APPEND RUNTIME_TARGETS "${target}")
@@ -169,6 +170,7 @@ foreach(target aarch64-unknown-linux-gnu;armv7-unknown-linux-gnueabihf;i386-unkn
169170
set(RUNTIMES_${target}_CMAKE_EXE_LINKER_FLAGS "-fuse-ld=lld" CACHE STRING "")
170171
set(RUNTIMES_${target}_COMPILER_RT_CXX_LIBRARY "libcxx" CACHE STRING "")
171172
set(RUNTIMES_${target}_COMPILER_RT_USE_BUILTINS_LIBRARY ON CACHE BOOL "")
173+
set(RUNTIMES_${target}_COMPILER_RT_USE_ATOMIC_LIBRARY ON CACHE BOOL "")
172174
set(RUNTIMES_${target}_COMPILER_RT_USE_LLVM_UNWINDER ON CACHE BOOL "")
173175
set(RUNTIMES_${target}_COMPILER_RT_CAN_EXECUTE_TESTS ON CACHE BOOL "")
174176
set(RUNTIMES_${target}_COMPILER_RT_BUILD_STANDALONE_LIBATOMIC ON CACHE BOOL "")

clang/docs/ReleaseNotes.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -346,6 +346,7 @@ Bug Fixes to C++ Support
346346
- Template parameter names are considered in the name lookup of out-of-line class template
347347
specialization right before its declaration context. (#GH64082)
348348
- Fixed a constraint comparison bug for friend declarations. (#GH78101)
349+
- Fix handling of ``_`` as the name of a lambda's init capture variable. (#GH107024)
349350

350351
Bug Fixes to AST Handling
351352
^^^^^^^^^^^^^^^^^^^^^^^^^

clang/lib/AST/ByteCode/Compiler.cpp

Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -298,8 +298,8 @@ bool Compiler<Emitter>::VisitCastExpr(const CastExpr *CE) {
298298
return false;
299299

300300
const auto *TargetSemantics = &Ctx.getFloatSemantics(CE->getType());
301-
llvm::RoundingMode RM = getRoundingMode(CE);
302-
return this->emitCastIntegralFloating(*FromT, TargetSemantics, RM, CE);
301+
return this->emitCastIntegralFloating(*FromT, TargetSemantics,
302+
getFPOptions(CE), CE);
303303
}
304304

305305
case CK_FloatingToBoolean:
@@ -317,12 +317,12 @@ bool Compiler<Emitter>::VisitCastExpr(const CastExpr *CE) {
317317

318318
if (ToT == PT_IntAP)
319319
return this->emitCastFloatingIntegralAP(Ctx.getBitWidth(CE->getType()),
320-
CE);
320+
getFPOptions(CE), CE);
321321
if (ToT == PT_IntAPS)
322322
return this->emitCastFloatingIntegralAPS(Ctx.getBitWidth(CE->getType()),
323-
CE);
323+
getFPOptions(CE), CE);
324324

325-
return this->emitCastFloatingIntegral(*ToT, CE);
325+
return this->emitCastFloatingIntegral(*ToT, getFPOptions(CE), CE);
326326
}
327327

328328
case CK_NullToPointer:
@@ -810,21 +810,21 @@ bool Compiler<Emitter>::VisitBinaryOperator(const BinaryOperator *BO) {
810810
return MaybeCastToBool(this->emitGE(*LT, BO));
811811
case BO_Sub:
812812
if (BO->getType()->isFloatingType())
813-
return Discard(this->emitSubf(getRoundingMode(BO), BO));
813+
return Discard(this->emitSubf(getFPOptions(BO), BO));
814814
return Discard(this->emitSub(*T, BO));
815815
case BO_Add:
816816
if (BO->getType()->isFloatingType())
817-
return Discard(this->emitAddf(getRoundingMode(BO), BO));
817+
return Discard(this->emitAddf(getFPOptions(BO), BO));
818818
return Discard(this->emitAdd(*T, BO));
819819
case BO_Mul:
820820
if (BO->getType()->isFloatingType())
821-
return Discard(this->emitMulf(getRoundingMode(BO), BO));
821+
return Discard(this->emitMulf(getFPOptions(BO), BO));
822822
return Discard(this->emitMul(*T, BO));
823823
case BO_Rem:
824824
return Discard(this->emitRem(*T, BO));
825825
case BO_Div:
826826
if (BO->getType()->isFloatingType())
827-
return Discard(this->emitDivf(getRoundingMode(BO), BO));
827+
return Discard(this->emitDivf(getFPOptions(BO), BO));
828828
return Discard(this->emitDiv(*T, BO));
829829
case BO_Assign:
830830
if (DiscardResult)
@@ -1153,7 +1153,7 @@ bool Compiler<Emitter>::VisitComplexBinOp(const BinaryOperator *E) {
11531153
if (!loadComplexValue(RHSIsComplex, true, ElemIndex, RHSOffset, RHS))
11541154
return false;
11551155
if (ResultElemT == PT_Float) {
1156-
if (!this->emitAddf(getRoundingMode(E), E))
1156+
if (!this->emitAddf(getFPOptions(E), E))
11571157
return false;
11581158
} else {
11591159
if (!this->emitAdd(ResultElemT, E))
@@ -1167,7 +1167,7 @@ bool Compiler<Emitter>::VisitComplexBinOp(const BinaryOperator *E) {
11671167
if (!loadComplexValue(RHSIsComplex, true, ElemIndex, RHSOffset, RHS))
11681168
return false;
11691169
if (ResultElemT == PT_Float) {
1170-
if (!this->emitSubf(getRoundingMode(E), E))
1170+
if (!this->emitSubf(getFPOptions(E), E))
11711171
return false;
11721172
} else {
11731173
if (!this->emitSub(ResultElemT, E))
@@ -1182,7 +1182,7 @@ bool Compiler<Emitter>::VisitComplexBinOp(const BinaryOperator *E) {
11821182
return false;
11831183

11841184
if (ResultElemT == PT_Float) {
1185-
if (!this->emitMulf(getRoundingMode(E), E))
1185+
if (!this->emitMulf(getFPOptions(E), E))
11861186
return false;
11871187
} else {
11881188
if (!this->emitMul(ResultElemT, E))
@@ -1198,7 +1198,7 @@ bool Compiler<Emitter>::VisitComplexBinOp(const BinaryOperator *E) {
11981198
return false;
11991199

12001200
if (ResultElemT == PT_Float) {
1201-
if (!this->emitDivf(getRoundingMode(E), E))
1201+
if (!this->emitDivf(getFPOptions(E), E))
12021202
return false;
12031203
} else {
12041204
if (!this->emitDiv(ResultElemT, E))
@@ -2063,22 +2063,21 @@ bool Compiler<Emitter>::VisitFloatCompoundAssignOperator(
20632063
if (!this->emitGetLocal(*RT, TempOffset, E))
20642064
return false;
20652065

2066-
llvm::RoundingMode RM = getRoundingMode(E);
20672066
switch (E->getOpcode()) {
20682067
case BO_AddAssign:
2069-
if (!this->emitAddf(RM, E))
2068+
if (!this->emitAddf(getFPOptions(E), E))
20702069
return false;
20712070
break;
20722071
case BO_SubAssign:
2073-
if (!this->emitSubf(RM, E))
2072+
if (!this->emitSubf(getFPOptions(E), E))
20742073
return false;
20752074
break;
20762075
case BO_MulAssign:
2077-
if (!this->emitMulf(RM, E))
2076+
if (!this->emitMulf(getFPOptions(E), E))
20782077
return false;
20792078
break;
20802079
case BO_DivAssign:
2081-
if (!this->emitDivf(RM, E))
2080+
if (!this->emitDivf(getFPOptions(E), E))
20822081
return false;
20832082
break;
20842083
default:
@@ -3325,7 +3324,7 @@ template <class Emitter> bool Compiler<Emitter>::visitBool(const Expr *E) {
33253324

33263325
// Or Floats.
33273326
if (T == PT_Float)
3328-
return this->emitCastFloatingIntegralBool(E);
3327+
return this->emitCastFloatingIntegralBool(getFPOptions(E), E);
33293328

33303329
// Or anything else we can.
33313330
return this->emitCast(*T, PT_Bool, E);
@@ -5005,8 +5004,8 @@ bool Compiler<Emitter>::VisitUnaryOperator(const UnaryOperator *E) {
50055004
}
50065005

50075006
if (T == PT_Float) {
5008-
return DiscardResult ? this->emitIncfPop(getRoundingMode(E), E)
5009-
: this->emitIncf(getRoundingMode(E), E);
5007+
return DiscardResult ? this->emitIncfPop(getFPOptions(E), E)
5008+
: this->emitIncf(getFPOptions(E), E);
50105009
}
50115010

50125011
return DiscardResult ? this->emitIncPop(*T, E) : this->emitInc(*T, E);
@@ -5028,8 +5027,8 @@ bool Compiler<Emitter>::VisitUnaryOperator(const UnaryOperator *E) {
50285027
}
50295028

50305029
if (T == PT_Float) {
5031-
return DiscardResult ? this->emitDecfPop(getRoundingMode(E), E)
5032-
: this->emitDecf(getRoundingMode(E), E);
5030+
return DiscardResult ? this->emitDecfPop(getFPOptions(E), E)
5031+
: this->emitDecf(getFPOptions(E), E);
50335032
}
50345033

50355034
return DiscardResult ? this->emitDecPop(*T, E) : this->emitDec(*T, E);
@@ -5056,7 +5055,7 @@ bool Compiler<Emitter>::VisitUnaryOperator(const UnaryOperator *E) {
50565055
// Post-inc and pre-inc are the same if the value is to be discarded.
50575056
if (DiscardResult) {
50585057
if (T == PT_Float)
5059-
return this->emitIncfPop(getRoundingMode(E), E);
5058+
return this->emitIncfPop(getFPOptions(E), E);
50605059
return this->emitIncPop(*T, E);
50615060
}
50625061

@@ -5066,7 +5065,7 @@ bool Compiler<Emitter>::VisitUnaryOperator(const UnaryOperator *E) {
50665065
return false;
50675066
if (!this->emitConstFloat(llvm::APFloat(TargetSemantics, 1), E))
50685067
return false;
5069-
if (!this->emitAddf(getRoundingMode(E), E))
5068+
if (!this->emitAddf(getFPOptions(E), E))
50705069
return false;
50715070
if (!this->emitStoreFloat(E))
50725071
return false;
@@ -5105,7 +5104,7 @@ bool Compiler<Emitter>::VisitUnaryOperator(const UnaryOperator *E) {
51055104
// Post-dec and pre-dec are the same if the value is to be discarded.
51065105
if (DiscardResult) {
51075106
if (T == PT_Float)
5108-
return this->emitDecfPop(getRoundingMode(E), E);
5107+
return this->emitDecfPop(getFPOptions(E), E);
51095108
return this->emitDecPop(*T, E);
51105109
}
51115110

@@ -5115,7 +5114,7 @@ bool Compiler<Emitter>::VisitUnaryOperator(const UnaryOperator *E) {
51155114
return false;
51165115
if (!this->emitConstFloat(llvm::APFloat(TargetSemantics, 1), E))
51175116
return false;
5118-
if (!this->emitSubf(getRoundingMode(E), E))
5117+
if (!this->emitSubf(getFPOptions(E), E))
51195118
return false;
51205119
if (!this->emitStoreFloat(E))
51215120
return false;
@@ -5579,13 +5578,15 @@ bool Compiler<Emitter>::emitPrimCast(PrimType FromT, PrimType ToT,
55795578
}
55805579

55815580
if (ToT == PT_IntAP)
5582-
return this->emitCastFloatingIntegralAP(Ctx.getBitWidth(ToQT), E);
5581+
return this->emitCastFloatingIntegralAP(Ctx.getBitWidth(ToQT),
5582+
getFPOptions(E), E);
55835583
if (ToT == PT_IntAPS)
5584-
return this->emitCastFloatingIntegralAPS(Ctx.getBitWidth(ToQT), E);
5584+
return this->emitCastFloatingIntegralAPS(Ctx.getBitWidth(ToQT),
5585+
getFPOptions(E), E);
55855586

55865587
// Float to integral.
55875588
if (isIntegralType(ToT) || ToT == PT_Bool)
5588-
return this->emitCastFloatingIntegral(ToT, E);
5589+
return this->emitCastFloatingIntegral(ToT, getFPOptions(E), E);
55895590
}
55905591

55915592
if (isIntegralType(FromT) || FromT == PT_Bool) {
@@ -5601,8 +5602,7 @@ bool Compiler<Emitter>::emitPrimCast(PrimType FromT, PrimType ToT,
56015602
if (ToT == PT_Float) {
56025603
// Integral to floating.
56035604
const llvm::fltSemantics *ToSem = &Ctx.getFloatSemantics(ToQT);
5604-
return this->emitCastIntegralFloating(FromT, ToSem, getRoundingMode(E),
5605-
E);
5605+
return this->emitCastIntegralFloating(FromT, ToSem, getFPOptions(E), E);
56065606
}
56075607
}
56085608

@@ -5639,7 +5639,7 @@ bool Compiler<Emitter>::emitComplexBoolCast(const Expr *E) {
56395639
if (!this->emitArrayElem(ElemT, 0, E))
56405640
return false;
56415641
if (ElemT == PT_Float) {
5642-
if (!this->emitCastFloatingIntegral(PT_Bool, E))
5642+
if (!this->emitCastFloatingIntegral(PT_Bool, getFPOptions(E), E))
56435643
return false;
56445644
} else {
56455645
if (!this->emitCast(ElemT, PT_Bool, E))
@@ -5654,7 +5654,7 @@ bool Compiler<Emitter>::emitComplexBoolCast(const Expr *E) {
56545654
if (!this->emitArrayElemPop(ElemT, 1, E))
56555655
return false;
56565656
if (ElemT == PT_Float) {
5657-
if (!this->emitCastFloatingIntegral(PT_Bool, E))
5657+
if (!this->emitCastFloatingIntegral(PT_Bool, getFPOptions(E), E))
56585658
return false;
56595659
} else {
56605660
if (!this->emitCast(ElemT, PT_Bool, E))

clang/lib/AST/ByteCode/Compiler.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -341,6 +341,10 @@ class Compiler : public ConstStmtVisitor<Compiler<Emitter>, bool>,
341341
return FPO.getRoundingMode();
342342
}
343343

344+
uint32_t getFPOptions(const Expr *E) const {
345+
return E->getFPFeaturesInEffect(Ctx.getLangOpts()).getAsOpaqueInt();
346+
}
347+
344348
bool emitPrimCast(PrimType FromT, PrimType ToT, QualType ToQT, const Expr *E);
345349
PrimType classifyComplexElementType(QualType T) const {
346350
assert(T->isAnyComplexType());

0 commit comments

Comments
 (0)