Skip to content

Commit 75e05a4

Browse files
committed
Merge 4b409fa from sycl-web
CONFLICT (content): Merge conflict in llvm/utils/git/requirements.txt CONFLICT (content): Merge conflict in llvm/utils/git/requirements_formatting.txt
2 parents a78cf31 + 4b409fa commit 75e05a4

File tree

6,802 files changed

+392887
-145589
lines changed

Some content is hidden

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

6,802 files changed

+392887
-145589
lines changed

.github/new-prs-labeler.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -668,7 +668,7 @@ mlgo:
668668
- llvm/lib/CodeGen/ML*
669669
- llvm/unittests/CodeGen/ML*
670670
- llvm/test/CodeGen/MLRegAlloc/**
671-
- llvm/utils/mlgo-utils/*
671+
- llvm/utils/mlgo-utils/**
672672

673673
tools:llvm-exegesis:
674674
- llvm/tools/llvm-exegesis/**
@@ -1008,3 +1008,8 @@ bazel:
10081008

10091009
offload:
10101010
- offload/**
1011+
1012+
tablegen:
1013+
- llvm/include/TableGen/**
1014+
- llvm/lib/TableGen/**
1015+
- llvm/utils/TableGen/**

.github/workflows/commit-access-review.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -358,11 +358,10 @@ def main():
358358
gh = github.Github(login_or_token=token)
359359
org = gh.get_organization("llvm")
360360
repo = org.get_repo("llvm-project")
361-
team = org.get_team_by_slug("llvm-committers")
362361
one_year_ago = datetime.datetime.now() - datetime.timedelta(days=365)
363362
triage_list = {}
364-
for member in team.get_members():
365-
triage_list[member.login] = User(member.login, triage_list)
363+
for collaborator in repo.get_collaborators(permission="push"):
364+
triage_list[collaborator.login] = User(collaborator.login, triage_list)
366365

367366
print("Start:", len(triage_list), "triagers")
368367
# Step 0 Check if users have requested commit access in the last year.

.github/workflows/libcxx-build-and-test.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,7 @@ jobs:
242242
- { config: mingw-dll, mingw: true }
243243
- { config: mingw-static, mingw: true }
244244
- { config: mingw-dll-i686, mingw: true }
245+
- { config: mingw-incomplete-sysroot, mingw: true }
245246
steps:
246247
- uses: actions/checkout@v4
247248
- name: Install dependencies
@@ -260,6 +261,12 @@ jobs:
260261
del llvm-mingw*.zip
261262
mv llvm-mingw* c:\llvm-mingw
262263
echo "c:\llvm-mingw\bin" | Out-File -FilePath $Env:GITHUB_PATH -Encoding utf8 -Append
264+
- name: Simulate a from-scratch build of llvm-mingw
265+
if: ${{ matrix.config == 'mingw-incomplete-sysroot' }}
266+
run: |
267+
rm -r c:\llvm-mingw\include\c++
268+
rm -r c:\llvm-mingw\*-w64-mingw32\lib\libc++*
269+
rm -r c:\llvm-mingw\*-w64-mingw32\lib\libunwind*
263270
- name: Add Git Bash to the path
264271
run: |
265272
echo "c:\Program Files\Git\usr\bin" | Out-File -FilePath $Env:GITHUB_PATH -Encoding utf8 -Append

.github/workflows/release-binaries.yml

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -442,11 +442,22 @@ jobs:
442442
name: ${{ needs.prepare.outputs.release-binary-filename }}-attestation
443443
path: ${{ needs.prepare.outputs.release-binary-filename }}.jsonl
444444

445+
- name: Checkout Release Scripts
446+
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
447+
with:
448+
sparse-checkout: |
449+
llvm/utils/release/github-upload-release.py
450+
llvm/utils/git/requirements.txt
451+
sparse-checkout-cone-mode: false
452+
453+
- name: Install Python Requirements
454+
run: |
455+
pip install --require-hashes -r ./llvm/utils/git/requirements.txt
456+
445457
- name: Upload Release
446458
shell: bash
447459
run: |
448-
sudo apt install python3-github
449-
./llvm-project/llvm/utils/release/github-upload-release.py \
460+
./llvm/utils/release/github-upload-release.py \
450461
--token ${{ github.token }} \
451462
--release ${{ needs.prepare.outputs.release-version }} \
452463
upload \

bolt/include/bolt/Profile/ProfileYAMLMapping.h

Lines changed: 65 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -95,24 +95,29 @@ template <> struct MappingTraits<bolt::SuccessorInfo> {
9595

9696
namespace bolt {
9797
struct PseudoProbeInfo {
98-
llvm::yaml::Hex64 GUID;
99-
uint64_t Index;
100-
uint8_t Type;
98+
uint32_t InlineTreeIndex = 0;
99+
uint64_t BlockMask = 0; // bitset with probe indices from 1 to 64
100+
std::vector<uint64_t> BlockProbes; // block probes with indices above 64
101+
std::vector<uint64_t> CallProbes;
102+
std::vector<uint64_t> IndCallProbes;
103+
std::vector<uint32_t> InlineTreeNodes;
101104

102105
bool operator==(const PseudoProbeInfo &Other) const {
103-
return GUID == Other.GUID && Index == Other.Index;
104-
}
105-
bool operator!=(const PseudoProbeInfo &Other) const {
106-
return !(*this == Other);
106+
return InlineTreeIndex == Other.InlineTreeIndex &&
107+
BlockProbes == Other.BlockProbes && CallProbes == Other.CallProbes &&
108+
IndCallProbes == Other.IndCallProbes;
107109
}
108110
};
109111
} // end namespace bolt
110112

111113
template <> struct MappingTraits<bolt::PseudoProbeInfo> {
112114
static void mapping(IO &YamlIO, bolt::PseudoProbeInfo &PI) {
113-
YamlIO.mapRequired("guid", PI.GUID);
114-
YamlIO.mapRequired("id", PI.Index);
115-
YamlIO.mapRequired("type", PI.Type);
115+
YamlIO.mapOptional("blx", PI.BlockMask, 0);
116+
YamlIO.mapOptional("blk", PI.BlockProbes, std::vector<uint64_t>());
117+
YamlIO.mapOptional("call", PI.CallProbes, std::vector<uint64_t>());
118+
YamlIO.mapOptional("icall", PI.IndCallProbes, std::vector<uint64_t>());
119+
YamlIO.mapOptional("id", PI.InlineTreeIndex, 0);
120+
YamlIO.mapOptional("ids", PI.InlineTreeNodes, std::vector<uint32_t>());
116121
}
117122

118123
static const bool flow = true;
@@ -158,15 +163,35 @@ template <> struct MappingTraits<bolt::BinaryBasicBlockProfile> {
158163
std::vector<bolt::CallSiteInfo>());
159164
YamlIO.mapOptional("succ", BBP.Successors,
160165
std::vector<bolt::SuccessorInfo>());
161-
YamlIO.mapOptional("pseudo_probes", BBP.PseudoProbes,
166+
YamlIO.mapOptional("probes", BBP.PseudoProbes,
162167
std::vector<bolt::PseudoProbeInfo>());
163168
}
164169
};
165170

171+
namespace bolt {
172+
struct InlineTreeNode {
173+
uint32_t ParentIndexDelta;
174+
uint32_t CallSiteProbe;
175+
// Index in PseudoProbeDesc.GUID, UINT32_MAX for same as previous (omitted)
176+
uint32_t GUIDIndex;
177+
bool operator==(const InlineTreeNode &) const { return false; }
178+
};
179+
} // end namespace bolt
180+
181+
template <> struct MappingTraits<bolt::InlineTreeNode> {
182+
static void mapping(IO &YamlIO, bolt::InlineTreeNode &ITI) {
183+
YamlIO.mapOptional("g", ITI.GUIDIndex, UINT32_MAX);
184+
YamlIO.mapOptional("p", ITI.ParentIndexDelta, 0);
185+
YamlIO.mapOptional("cs", ITI.CallSiteProbe, 0);
186+
}
187+
188+
static const bool flow = true;
189+
};
166190
} // end namespace yaml
167191
} // end namespace llvm
168192

169193
LLVM_YAML_IS_SEQUENCE_VECTOR(llvm::yaml::bolt::BinaryBasicBlockProfile)
194+
LLVM_YAML_IS_FLOW_SEQUENCE_VECTOR(llvm::yaml::bolt::InlineTreeNode)
170195

171196
namespace llvm {
172197
namespace yaml {
@@ -179,8 +204,7 @@ struct BinaryFunctionProfile {
179204
llvm::yaml::Hex64 Hash{0};
180205
uint64_t ExecCount{0};
181206
std::vector<BinaryBasicBlockProfile> Blocks;
182-
llvm::yaml::Hex64 GUID{0};
183-
llvm::yaml::Hex64 PseudoProbeDescHash{0};
207+
std::vector<InlineTreeNode> InlineTree;
184208
bool Used{false};
185209
};
186210
} // end namespace bolt
@@ -194,9 +218,8 @@ template <> struct MappingTraits<bolt::BinaryFunctionProfile> {
194218
YamlIO.mapRequired("nblocks", BFP.NumBasicBlocks);
195219
YamlIO.mapOptional("blocks", BFP.Blocks,
196220
std::vector<bolt::BinaryBasicBlockProfile>());
197-
YamlIO.mapOptional("guid", BFP.GUID, (uint64_t)0);
198-
YamlIO.mapOptional("pseudo_probe_desc_hash", BFP.PseudoProbeDescHash,
199-
(uint64_t)0);
221+
YamlIO.mapOptional("inline_tree", BFP.InlineTree,
222+
std::vector<bolt::InlineTreeNode>());
200223
}
201224
};
202225

@@ -246,10 +269,33 @@ template <> struct MappingTraits<bolt::BinaryProfileHeader> {
246269
}
247270
};
248271

272+
namespace bolt {
273+
struct ProfilePseudoProbeDesc {
274+
std::vector<Hex64> GUID;
275+
std::vector<Hex64> Hash;
276+
std::vector<uint32_t> GUIDHashIdx; // Index of hash for that GUID in Hash
277+
278+
bool operator==(const ProfilePseudoProbeDesc &Other) const {
279+
// Only treat empty Desc as equal
280+
return GUID.empty() && Other.GUID.empty() && Hash.empty() &&
281+
Other.Hash.empty() && GUIDHashIdx.empty() &&
282+
Other.GUIDHashIdx.empty();
283+
}
284+
};
285+
} // end namespace bolt
286+
287+
template <> struct MappingTraits<bolt::ProfilePseudoProbeDesc> {
288+
static void mapping(IO &YamlIO, bolt::ProfilePseudoProbeDesc &PD) {
289+
YamlIO.mapRequired("gs", PD.GUID);
290+
YamlIO.mapRequired("gh", PD.GUIDHashIdx);
291+
YamlIO.mapRequired("hs", PD.Hash);
292+
}
293+
};
249294
} // end namespace yaml
250295
} // end namespace llvm
251296

252297
LLVM_YAML_IS_SEQUENCE_VECTOR(llvm::yaml::bolt::BinaryFunctionProfile)
298+
LLVM_YAML_IS_SEQUENCE_VECTOR(llvm::yaml::bolt::ProfilePseudoProbeDesc)
253299

254300
namespace llvm {
255301
namespace yaml {
@@ -258,13 +304,16 @@ namespace bolt {
258304
struct BinaryProfile {
259305
BinaryProfileHeader Header;
260306
std::vector<BinaryFunctionProfile> Functions;
307+
ProfilePseudoProbeDesc PseudoProbeDesc;
261308
};
262309
} // namespace bolt
263310

264311
template <> struct MappingTraits<bolt::BinaryProfile> {
265312
static void mapping(IO &YamlIO, bolt::BinaryProfile &BP) {
266313
YamlIO.mapRequired("header", BP.Header);
267314
YamlIO.mapRequired("functions", BP.Functions);
315+
YamlIO.mapOptional("pseudo_probe_desc", BP.PseudoProbeDesc,
316+
bolt::ProfilePseudoProbeDesc());
268317
}
269318
};
270319

bolt/include/bolt/Profile/YAMLProfileWriter.h

Lines changed: 51 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,27 @@ class YAMLProfileWriter {
3232
/// Save execution profile for that instance.
3333
std::error_code writeProfile(const RewriteInstance &RI);
3434

35+
using InlineTreeMapTy =
36+
DenseMap<const MCDecodedPseudoProbeInlineTree *, uint32_t>;
37+
struct InlineTreeDesc {
38+
template <typename T> using GUIDMapTy = std::unordered_map<uint64_t, T>;
39+
using GUIDNodeMap = GUIDMapTy<const MCDecodedPseudoProbeInlineTree *>;
40+
using GUIDNumMap = GUIDMapTy<uint32_t>;
41+
GUIDNodeMap TopLevelGUIDToInlineTree;
42+
GUIDNumMap GUIDIdxMap;
43+
GUIDNumMap HashIdxMap;
44+
};
45+
46+
static std::tuple<std::vector<yaml::bolt::InlineTreeNode>, InlineTreeMapTy>
47+
convertBFInlineTree(const MCPseudoProbeDecoder &Decoder,
48+
const InlineTreeDesc &InlineTree, uint64_t GUID);
49+
50+
static std::tuple<yaml::bolt::ProfilePseudoProbeDesc, InlineTreeDesc>
51+
convertPseudoProbeDesc(const MCPseudoProbeDecoder &PseudoProbeDecoder);
52+
3553
static yaml::bolt::BinaryFunctionProfile
3654
convert(const BinaryFunction &BF, bool UseDFS,
55+
const InlineTreeDesc &InlineTree,
3756
const BoltAddressTranslation *BAT = nullptr);
3857

3958
/// Set CallSiteInfo destination fields from \p Symbol and return a target
@@ -42,8 +61,39 @@ class YAMLProfileWriter {
4261
setCSIDestination(const BinaryContext &BC, yaml::bolt::CallSiteInfo &CSI,
4362
const MCSymbol *Symbol, const BoltAddressTranslation *BAT,
4463
uint32_t Offset = 0);
45-
};
4664

65+
private:
66+
struct InlineTreeNode {
67+
const MCDecodedPseudoProbeInlineTree *InlineTree;
68+
uint64_t GUID;
69+
uint64_t Hash;
70+
uint32_t ParentId;
71+
uint32_t InlineSite;
72+
};
73+
static std::vector<InlineTreeNode>
74+
collectInlineTree(const MCPseudoProbeDecoder &Decoder,
75+
const MCDecodedPseudoProbeInlineTree &Root);
76+
77+
// 0 - block probe, 1 - indirect call, 2 - direct call
78+
using ProbeList = std::array<SmallVector<uint64_t, 0>, 3>;
79+
using NodeIdToProbes = DenseMap<uint32_t, ProbeList>;
80+
static std::vector<yaml::bolt::PseudoProbeInfo>
81+
convertNodeProbes(NodeIdToProbes &NodeProbes);
82+
83+
public:
84+
template <typename T>
85+
static std::vector<yaml::bolt::PseudoProbeInfo>
86+
writeBlockProbes(T Probes, const InlineTreeMapTy &InlineTreeNodeId) {
87+
NodeIdToProbes NodeProbes;
88+
for (const MCDecodedPseudoProbe &Probe : Probes) {
89+
auto It = InlineTreeNodeId.find(Probe.getInlineTreeNode());
90+
if (It == InlineTreeNodeId.end())
91+
continue;
92+
NodeProbes[It->second][Probe.getType()].emplace_back(Probe.getIndex());
93+
}
94+
return convertNodeProbes(NodeProbes);
95+
}
96+
};
4797
} // namespace bolt
4898
} // namespace llvm
4999

bolt/include/bolt/Utils/Utils.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,11 @@ std::string getEscapedName(const StringRef &Name);
4141
/// Return the unescaped name
4242
std::string getUnescapedName(const StringRef &Name);
4343

44+
/// Return a common part for a given \p Name wrt a given \p Suffixes list.
45+
/// Preserve the suffix if \p KeepSuffix is set, only dropping characters
46+
/// following it, otherwise drop the suffix as well.
47+
std::optional<StringRef> getCommonName(const StringRef Name, bool KeepSuffix,
48+
ArrayRef<StringRef> Suffixes);
4449
/// LTO-generated function names take a form:
4550
///
4651
/// <function_name>.lto_priv.<decimal_number>/...

bolt/lib/Passes/ADRRelaxationPass.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,15 @@ void ADRRelaxationPass::runOnFunction(BinaryFunction &BF) {
5959
// Don't relax adr if it points to the same function and it is not split
6060
// and BF initial size is < 1MB.
6161
const unsigned OneMB = 0x100000;
62-
if (!BF.isSplit() && BF.getSize() < OneMB) {
62+
if (BF.getSize() < OneMB) {
6363
BinaryFunction *TargetBF = BC.getFunctionForSymbol(Symbol);
64-
if (TargetBF && TargetBF == &BF)
64+
if (TargetBF == &BF && !BF.isSplit())
6565
continue;
66+
// No relaxation needed if ADR references a basic block in the same
67+
// fragment.
68+
if (BinaryBasicBlock *TargetBB = BF.getBasicBlockForLabel(Symbol))
69+
if (BB.getFragmentNum() == TargetBB->getFragmentNum())
70+
continue;
6671
}
6772

6873
MCPhysReg Reg;

0 commit comments

Comments
 (0)