Skip to content

Commit 0636404

Browse files
committed
Merge branch 'main' into add-tests-for-assign
2 parents 4ada49a + 4104906 commit 0636404

File tree

118 files changed

+2725
-1008
lines changed

Some content is hidden

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

118 files changed

+2725
-1008
lines changed

bolt/include/bolt/Passes/ADRRelaxationPass.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ namespace bolt {
2525

2626
class ADRRelaxationPass : public BinaryFunctionPass {
2727
public:
28-
explicit ADRRelaxationPass() : BinaryFunctionPass(false) {}
28+
explicit ADRRelaxationPass(const cl::opt<bool> &PrintPass)
29+
: BinaryFunctionPass(PrintPass) {}
2930

3031
const char *getName() const override { return "adr-relaxation"; }
3132

bolt/lib/Passes/LongJmp.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -138,9 +138,9 @@ BinaryBasicBlock *LongJmpPass::lookupStubFromGroup(
138138
const std::pair<uint64_t, BinaryBasicBlock *> &RHS) {
139139
return LHS.first < RHS.first;
140140
});
141-
if (Cand == Candidates.end())
142-
return nullptr;
143-
if (Cand != Candidates.begin()) {
141+
if (Cand == Candidates.end()) {
142+
Cand = std::prev(Cand);
143+
} else if (Cand != Candidates.begin()) {
144144
const StubTy *LeftCand = std::prev(Cand);
145145
if (Cand->first - DotAddress > DotAddress - LeftCand->first)
146146
Cand = LeftCand;

bolt/lib/Rewrite/BinaryPassManager.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,11 @@ static cl::opt<bool> PrintJTFootprintReduction(
126126
cl::desc("print function after jt-footprint-reduction pass"), cl::Hidden,
127127
cl::cat(BoltOptCategory));
128128

129+
static cl::opt<bool>
130+
PrintAdrRelaxation("print-adr-relaxation",
131+
cl::desc("print functions after ADR Relaxation pass"),
132+
cl::Hidden, cl::cat(BoltOptCategory));
133+
129134
static cl::opt<bool>
130135
PrintLongJmp("print-longjmp",
131136
cl::desc("print functions after longjmp pass"), cl::Hidden,
@@ -493,7 +498,8 @@ Error BinaryFunctionPassManager::runAllPasses(BinaryContext &BC) {
493498
Manager.registerPass(std::make_unique<ReorderData>());
494499

495500
if (BC.isAArch64()) {
496-
Manager.registerPass(std::make_unique<ADRRelaxationPass>());
501+
Manager.registerPass(
502+
std::make_unique<ADRRelaxationPass>(PrintAdrRelaxation));
497503

498504
// Tighten branches according to offset differences between branch and
499505
// targets. No extra instructions after this pass, otherwise we may have
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
## This test verifies that no unnecessary stubs are inserted when each DotAddress increases during a lookup.
2+
3+
# REQUIRES: system-linux, asserts
4+
5+
# RUN: llvm-mc -filetype=obj -triple aarch64-unknown-unknown %s -o %t.o
6+
# RUN: %clang %cflags -O0 %t.o -o %t.exe -Wl,-q
7+
# RUN: link_fdata %s %t.o %t.fdata
8+
# RUN: llvm-bolt %t.exe -o %t.bolt \
9+
# RUN: --data %t.fdata | FileCheck %s
10+
11+
# CHECK: BOLT-INFO: Inserted 1 stubs in the hot area and 0 stubs in the cold area.
12+
13+
.section .text
14+
.global _start
15+
.global far_away_func
16+
17+
.align 4
18+
.global _start
19+
.type _start, %function
20+
_start:
21+
# FDATA: 0 [unknown] 0 1 _start 0 0 100
22+
bl far_away_func
23+
bl far_away_func
24+
ret
25+
.space 0x8000000
26+
.global far_away_func
27+
.type far_away_func, %function
28+
far_away_func:
29+
add x0, x0, #1
30+
ret
31+
32+
.reloc 0, R_AARCH64_NONE

clang/include/clang/AST/OpenACCClause.h

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -766,6 +766,29 @@ class OpenACCDetachClause final
766766
ArrayRef<Expr *> VarList, SourceLocation EndLoc);
767767
};
768768

769+
class OpenACCDeleteClause final
770+
: public OpenACCClauseWithVarList,
771+
public llvm::TrailingObjects<OpenACCDeleteClause, Expr *> {
772+
773+
OpenACCDeleteClause(SourceLocation BeginLoc, SourceLocation LParenLoc,
774+
ArrayRef<Expr *> VarList, SourceLocation EndLoc)
775+
: OpenACCClauseWithVarList(OpenACCClauseKind::Delete, BeginLoc, LParenLoc,
776+
EndLoc) {
777+
std::uninitialized_copy(VarList.begin(), VarList.end(),
778+
getTrailingObjects<Expr *>());
779+
setExprs(MutableArrayRef(getTrailingObjects<Expr *>(), VarList.size()));
780+
}
781+
782+
public:
783+
static bool classof(const OpenACCClause *C) {
784+
return C->getClauseKind() == OpenACCClauseKind::Delete;
785+
}
786+
static OpenACCDeleteClause *
787+
Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc,
788+
ArrayRef<Expr *> VarList, SourceLocation EndLoc);
789+
};
790+
791+
769792
class OpenACCNoCreateClause final
770793
: public OpenACCClauseWithVarList,
771794
public llvm::TrailingObjects<OpenACCNoCreateClause, Expr *> {

clang/include/clang/Basic/OpenACCClauses.def

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ VISIT_CLAUSE(Create)
3838
CLAUSE_ALIAS(PCreate, Create, true)
3939
CLAUSE_ALIAS(PresentOrCreate, Create, true)
4040
VISIT_CLAUSE(Default)
41+
VISIT_CLAUSE(Delete)
4142
VISIT_CLAUSE(Detach)
4243
VISIT_CLAUSE(DevicePtr)
4344
VISIT_CLAUSE(DeviceType)

clang/include/clang/Basic/arm_sme.td

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -748,11 +748,28 @@ let SMETargetGuard = "sme2" in {
748748
let SMETargetGuard = "sme-f8f32" in {
749749
def SVDOT_LANE_FP8_ZA32_VG1x2 : Inst<"svdot_lane_za32[_mf8]_vg1x2_fpm", "vm2di>", "m", MergeNone, "aarch64_sme_fp8_fdot_lane_za32_vg1x2", [IsStreaming, IsInOutZA, SetsFPMR, IsOverloadNone], [ImmCheck<3, ImmCheck0_3>]>;
750750
def SVDOT_LANE_FP8_ZA32_VG1x4 : Inst<"svdot_lane_za32[_mf8]_vg1x4_fpm", "vm4di>", "m", MergeNone, "aarch64_sme_fp8_fdot_lane_za32_vg1x4", [IsStreaming, IsInOutZA, SetsFPMR, IsOverloadNone], [ImmCheck<3, ImmCheck0_3>]>;
751+
752+
def SVVDOTB_LANE_FP8_ZA32_VG1x4 : Inst<"svvdotb_lane_za32[_mf8]_vg1x4_fpm", "vm2di>", "m", MergeNone, "aarch64_sme_fp8_fvdotb_lane_za32_vg1x4", [IsOverloadNone, IsStreaming, IsInOutZA, SetsFPMR], [ImmCheck<3, ImmCheck0_3>]>;
753+
def SVVDOTT_LANE_FP8_ZA32_VG1x4 : Inst<"svvdott_lane_za32[_mf8]_vg1x4_fpm", "vm2di>", "m", MergeNone, "aarch64_sme_fp8_fvdott_lane_za32_vg1x4", [IsOverloadNone, IsStreaming, IsInOutZA, SetsFPMR], [ImmCheck<3, ImmCheck0_3>]>;
754+
755+
def SVDOT_SINGLE_FP8_ZA32_VG1x2 : Inst<"svdot[_single]_za32[_mf8]_vg1x2_fpm", "vm2d>", "m", MergeNone, "aarch64_sme_fp8_fdot_single_za32_vg1x2", [IsStreaming, IsInOutZA, SetsFPMR, IsOverloadNone], []>;
756+
def SVDOT_SINGLE_FP8_ZA32_VG1x4 : Inst<"svdot[_single]_za32[_mf8]_vg1x4_fpm", "vm4d>", "m", MergeNone, "aarch64_sme_fp8_fdot_single_za32_vg1x4", [IsStreaming, IsInOutZA, SetsFPMR, IsOverloadNone], []>;
757+
758+
def SVDOT_MULTI_FP8_ZA32_VG1x2 : Inst<"svdot_za32[_mf8]_vg1x2_fpm", "vm22>", "m", MergeNone, "aarch64_sme_fp8_fdot_multi_za32_vg1x2", [IsStreaming, IsInOutZA, SetsFPMR, IsOverloadNone], []>;
759+
def SVDOT_MULTI_FP8_ZA32_VG1x4 : Inst<"svdot_za32[_mf8]_vg1x4_fpm", "vm44>", "m", MergeNone, "aarch64_sme_fp8_fdot_multi_za32_vg1x4", [IsStreaming, IsInOutZA, SetsFPMR, IsOverloadNone], []>;
751760
}
752761

753762
let SMETargetGuard = "sme-f8f16" in {
754763
def SVDOT_LANE_FP8_ZA16_VG1x2 : Inst<"svdot_lane_za16[_mf8]_vg1x2_fpm", "vm2di>", "m", MergeNone, "aarch64_sme_fp8_fdot_lane_za16_vg1x2", [IsStreaming, IsInOutZA, SetsFPMR, IsOverloadNone], [ImmCheck<3, ImmCheck0_7>]>;
755764
def SVDOT_LANE_FP8_ZA16_VG1x4 : Inst<"svdot_lane_za16[_mf8]_vg1x4_fpm", "vm4di>", "m", MergeNone, "aarch64_sme_fp8_fdot_lane_za16_vg1x4", [IsStreaming, IsInOutZA, SetsFPMR, IsOverloadNone], [ImmCheck<3, ImmCheck0_7>]>;
765+
766+
def SVVDOT_LANE_FP8_ZA16_VG1x2 : Inst<"svvdot_lane_za16[_mf8]_vg1x2_fpm", "vm2di>", "m", MergeNone, "aarch64_sme_fp8_fvdot_lane_za16_vg1x2", [IsOverloadNone, IsStreaming, IsInOutZA, SetsFPMR], [ImmCheck<3, ImmCheck0_7>]>;
767+
768+
def SVDOT_SINGLE_FP8_ZA16_VG1x2 : Inst<"svdot[_single]_za16[_mf8]_vg1x2_fpm", "vm2d>", "m", MergeNone, "aarch64_sme_fp8_fdot_single_za16_vg1x2", [IsStreaming, IsInOutZA, SetsFPMR, IsOverloadNone], []>;
769+
def SVDOT_SINGLE_FP8_ZA16_VG1x4 : Inst<"svdot[_single]_za16[_mf8]_vg1x4_fpm", "vm4d>", "m", MergeNone, "aarch64_sme_fp8_fdot_single_za16_vg1x4", [IsStreaming, IsInOutZA, SetsFPMR, IsOverloadNone], []>;
770+
771+
def SVDOT_MULTI_FP8_ZA16_VG1x2 : Inst<"svdot_za16[_mf8]_vg1x2_fpm", "vm22>", "m", MergeNone, "aarch64_sme_fp8_fdot_multi_za16_vg1x2", [IsStreaming, IsInOutZA, SetsFPMR, IsOverloadNone], []>;
772+
def SVDOT_MULTI_FP8_ZA16_VG1x4 : Inst<"svdot_za16[_mf8]_vg1x4_fpm", "vm44>", "m", MergeNone, "aarch64_sme_fp8_fdot_multi_za16_vg1x4", [IsStreaming, IsInOutZA, SetsFPMR, IsOverloadNone], []>;
756773
}
757774

758775
////////////////////////////////////////////////////////////////////////////////

clang/include/clang/Sema/SemaOpenACC.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -399,6 +399,7 @@ class SemaOpenACC : public SemaBase {
399399
ClauseKind == OpenACCClauseKind::PCreate ||
400400
ClauseKind == OpenACCClauseKind::PresentOrCreate ||
401401
ClauseKind == OpenACCClauseKind::Attach ||
402+
ClauseKind == OpenACCClauseKind::Delete ||
402403
ClauseKind == OpenACCClauseKind::Detach ||
403404
ClauseKind == OpenACCClauseKind::DevicePtr ||
404405
ClauseKind == OpenACCClauseKind::Reduction ||
@@ -536,6 +537,7 @@ class SemaOpenACC : public SemaBase {
536537
ClauseKind == OpenACCClauseKind::PCreate ||
537538
ClauseKind == OpenACCClauseKind::PresentOrCreate ||
538539
ClauseKind == OpenACCClauseKind::Attach ||
540+
ClauseKind == OpenACCClauseKind::Delete ||
539541
ClauseKind == OpenACCClauseKind::Detach ||
540542
ClauseKind == OpenACCClauseKind::DevicePtr ||
541543
ClauseKind == OpenACCClauseKind::FirstPrivate) &&
@@ -573,6 +575,7 @@ class SemaOpenACC : public SemaBase {
573575
ClauseKind == OpenACCClauseKind::PCreate ||
574576
ClauseKind == OpenACCClauseKind::PresentOrCreate ||
575577
ClauseKind == OpenACCClauseKind::Attach ||
578+
ClauseKind == OpenACCClauseKind::Delete ||
576579
ClauseKind == OpenACCClauseKind::Detach ||
577580
ClauseKind == OpenACCClauseKind::DevicePtr ||
578581
ClauseKind == OpenACCClauseKind::FirstPrivate) &&

clang/include/clang/Serialization/ASTBitCodes.h

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -724,11 +724,9 @@ enum ASTRecordTypes {
724724
/// Record code for vtables to emit.
725725
VTABLES_TO_EMIT = 70,
726726

727-
/// Record code for the FunctionDecl to lambdas mapping. These lambdas have to
728-
/// be loaded right after the function they belong to. It is required to have
729-
/// canonical declaration for the lambda class from the same module as
730-
/// enclosing function.
731-
FUNCTION_DECL_TO_LAMBDAS_MAP = 71,
727+
/// Record code for related declarations that have to be deserialized together
728+
/// from the same module.
729+
RELATED_DECLS_MAP = 71,
732730

733731
/// Record code for Sema's vector of functions/blocks with effects to
734732
/// be verified.

clang/include/clang/Serialization/ASTReader.h

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -537,17 +537,14 @@ class ASTReader
537537
/// namespace as if it is not delayed.
538538
DelayedNamespaceOffsetMapTy DelayedNamespaceOffsetMap;
539539

540-
/// Mapping from FunctionDecl IDs to the corresponding lambda IDs.
541-
///
542-
/// These lambdas have to be loaded right after the function they belong to.
543-
/// It is required to have canonical declaration for lambda class from the
544-
/// same module as enclosing function. This is required to correctly resolve
545-
/// captured variables in the lambda. Without this, due to lazy
546-
/// deserialization, canonical declarations for the function and lambdas can
547-
/// be selected from different modules and DeclRefExprs may refer to the AST
548-
/// nodes that don't exist in the function.
549-
llvm::DenseMap<GlobalDeclID, SmallVector<GlobalDeclID, 4>>
550-
FunctionToLambdasMap;
540+
/// Mapping from main decl ID to the related decls IDs.
541+
///
542+
/// These related decls have to be loaded right after the main decl.
543+
/// It is required to have canonical declaration for related decls from the
544+
/// same module as the enclosing main decl. Without this, due to lazy
545+
/// deserialization, canonical declarations for the main decl and related can
546+
/// be selected from different modules.
547+
llvm::DenseMap<GlobalDeclID, SmallVector<GlobalDeclID, 4>> RelatedDeclsMap;
551548

552549
struct PendingUpdateRecord {
553550
Decl *D;

0 commit comments

Comments
 (0)