Skip to content

Commit a33d91b

Browse files
committed
Merge branch 'main' into pauth-gnuprop-clang
2 parents 2038f8d + da1e3e8 commit a33d91b

File tree

6,099 files changed

+319063
-146440
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,099 files changed

+319063
-146440
lines changed

.ci/generate-buildkite-pipeline-premerge

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ function add-dependencies() {
108108
compiler-rt|libc|openmp)
109109
echo clang lld
110110
;;
111-
flang|lldb)
111+
flang|lldb|libclc)
112112
for p in llvm clang; do
113113
echo $p
114114
done

.github/CODEOWNERS

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,15 @@ clang/test/AST/Interp/ @tbaederr
113113

114114
# MLIR NVVM Dialect in MLIR
115115
/mlir/**/LLVMIR/**/BasicPtxBuilderInterface* @grypp
116-
/mlir/**/NVVM*/ @grypp
116+
/mlir/**/NVVM* @grypp
117+
118+
# MLIR Python Bindings
119+
/mlir/test/python/ @ftynse @makslevental @stellaraccident
120+
/mlir/python/ @ftynse @makslevental @stellaraccident
121+
122+
# MLIR Mem2Reg/SROA
123+
/mlir/**/Transforms/Mem2Reg.* @moxinilian
124+
/mlir/**/Transforms/SROA.* @moxinilian
117125

118126
# BOLT
119127
/bolt/ @aaupov @maksfb @rafaelauler @ayermolo @dcci

.github/new-prs-labeler.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
ClangIR:
2+
- clang/include/clang/CIR/**/*
3+
- clang/lib/CIR/**/*
4+
- clang/tools/cir-*/**/*
5+
- clang/test/CIR/**/*
6+
17
clang:dataflow:
28
- clang/include/clang/Analysis/FlowSensitive/**/*
39
- clang/lib/Analysis/FlowSensitive/**/*
@@ -938,3 +944,6 @@ openmp:libomptarget:
938944

939945
bazel:
940946
- utils/bazel/**
947+
948+
offload:
949+
- offload/**

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

Lines changed: 13 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,11 @@ env:
3838
# LLVM POST-BRANCH bump version
3939
# LLVM POST-BRANCH add compiler test for ToT - 1, e.g. "Clang 17"
4040
# LLVM RELEASE bump remove compiler ToT - 3, e.g. "Clang 15"
41-
LLVM_HEAD_VERSION: "18" # Used compiler, update POST-BRANCH.
42-
LLVM_PREVIOUS_VERSION: "17"
43-
LLVM_OLDEST_VERSION: "16"
41+
LLVM_HEAD_VERSION: "19" # Used compiler, update POST-BRANCH.
42+
LLVM_PREVIOUS_VERSION: "18"
43+
LLVM_OLDEST_VERSION: "17"
4444
GCC_STABLE_VERSION: "13"
45-
LLVM_SYMBOLIZER_PATH: "/usr/bin/llvm-symbolizer-18"
45+
LLVM_SYMBOLIZER_PATH: "/usr/bin/llvm-symbolizer-19"
4646
CLANG_CRASH_DIAGNOSTICS_DIR: "crash_diagnostics"
4747

4848

@@ -59,22 +59,19 @@ jobs:
5959
'generic-cxx26',
6060
'generic-modules'
6161
]
62-
cc: [ 'clang-18' ]
63-
cxx: [ 'clang++-18' ]
64-
clang_tidy: [ 'ON' ]
62+
cc: [ 'clang-19' ]
63+
cxx: [ 'clang++-19' ]
6564
include:
6665
- config: 'generic-gcc'
6766
cc: 'gcc-13'
6867
cxx: 'g++-13'
69-
clang_tidy: 'OFF'
7068
steps:
7169
- uses: actions/checkout@v4
7270
- name: ${{ matrix.config }}.${{ matrix.cxx }}
7371
run: libcxx/utils/ci/run-buildbot ${{ matrix.config }}
7472
env:
7573
CC: ${{ matrix.cc }}
7674
CXX: ${{ matrix.cxx }}
77-
ENABLE_CLANG_TIDY: ${{ matrix.clang_tidy }}
7875
- uses: actions/upload-artifact@26f96dfa697d77e81fd5907df203aa23a56210a8 # v4.3.0
7976
if: always()
8077
with:
@@ -100,30 +97,25 @@ jobs:
10097
'generic-cxx20',
10198
'generic-cxx23'
10299
]
103-
cc: [ 'clang-18' ]
104-
cxx: [ 'clang++-18' ]
105-
clang_tidy: [ 'ON' ]
100+
cc: [ 'clang-19' ]
101+
cxx: [ 'clang++-19' ]
106102
include:
107103
- config: 'generic-gcc-cxx11'
108104
cc: 'gcc-13'
109105
cxx: 'g++-13'
110-
clang_tidy: 'OFF'
111-
- config: 'generic-cxx23'
112-
cc: 'clang-16'
113-
cxx: 'clang++-16'
114-
clang_tidy: 'OFF'
115106
- config: 'generic-cxx23'
116107
cc: 'clang-17'
117108
cxx: 'clang++-17'
118-
clang_tidy: 'OFF'
109+
- config: 'generic-cxx26'
110+
cc: 'clang-18'
111+
cxx: 'clang++-18'
119112
steps:
120113
- uses: actions/checkout@v4
121114
- name: ${{ matrix.config }}
122115
run: libcxx/utils/ci/run-buildbot ${{ matrix.config }}
123116
env:
124117
CC: ${{ matrix.cc }}
125118
CXX: ${{ matrix.cxx }}
126-
ENABLE_CLANG_TIDY: ${{ matrix.clang_tidy }}
127119
- uses: actions/upload-artifact@26f96dfa697d77e81fd5907df203aa23a56210a8 # v4.3.0
128120
if: always() # Upload artifacts even if the build or test suite fails
129121
with:
@@ -186,9 +178,8 @@ jobs:
186178
- name: ${{ matrix.config }}
187179
run: libcxx/utils/ci/run-buildbot ${{ matrix.config }}
188180
env:
189-
CC: clang-18
190-
CXX: clang++-18
191-
ENABLE_CLANG_TIDY: "OFF"
181+
CC: clang-19
182+
CXX: clang++-19
192183
- uses: actions/upload-artifact@26f96dfa697d77e81fd5907df203aa23a56210a8 # v4.3.0
193184
if: always()
194185
with:

.github/workflows/pr-code-format.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
name: "Check code formatting"
2+
3+
permissions:
4+
contents: read
5+
26
on:
37
pull_request:
48
branches:

.github/workflows/release-lit.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ jobs:
5858
cd llvm/utils/lit
5959
# Remove 'dev' suffix from lit version.
6060
sed -i 's/ + "dev"//g' lit/__init__.py
61-
python3 setup.py sdist
61+
python3 setup.py sdist bdist_wheel
6262
6363
- name: Upload lit to test.pypi.org
6464
uses: pypa/gh-action-pypi-publish@release/v1

bolt/docs/BAT.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,10 @@ Hot indices are delta encoded, implicitly starting at zero.
8181
| `FuncHash` | 8b | Function hash for input function | Hot |
8282
| `NumBlocks` | ULEB128 | Number of basic blocks in the original function | Hot |
8383
| `NumSecEntryPoints` | ULEB128 | Number of secondary entry points in the original function | Hot |
84+
| `ColdInputSkew` | ULEB128 | Skew to apply to all input offsets | Cold |
8485
| `NumEntries` | ULEB128 | Number of address translation entries for a function | Both |
85-
| `EqualElems` | ULEB128 | Number of equal offsets in the beginning of a function | Hot |
86-
| `BranchEntries` | Bitmask, `alignTo(EqualElems, 8)` bits | If `EqualElems` is non-zero, bitmask denoting entries with `BRANCHENTRY` bit | Hot |
86+
| `EqualElems` | ULEB128 | Number of equal offsets in the beginning of a function | Both |
87+
| `BranchEntries` | Bitmask, `alignTo(EqualElems, 8)` bits | If `EqualElems` is non-zero, bitmask denoting entries with `BRANCHENTRY` bit | Both |
8788

8889
Function header is followed by *Address Translation Table* with `NumEntries`
8990
total entries, and *Secondary Entry Points* table with `NumSecEntryPoints`
@@ -99,8 +100,8 @@ entry is encoded. Input offsets implicitly start at zero.
99100
| `BBHash` | Optional, 8b | Basic block hash in input binary | BB |
100101
| `BBIdx` | Optional, Delta, ULEB128 | Basic block index in input binary | BB |
101102

102-
For hot fragments, the table omits the first `EqualElems` input offsets
103-
where the input offset equals output offset.
103+
The table omits the first `EqualElems` input offsets where the input offset
104+
equals output offset.
104105

105106
`BRANCHENTRY` bit denotes whether a given offset pair is a control flow source
106107
(branch or call instruction). If not set, it signifies a control flow target

bolt/include/bolt/Core/BinaryData.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,6 @@ class BinaryData {
107107
std::vector<MCSymbol *> &getSymbols() { return Symbols; }
108108

109109
bool hasName(StringRef Name) const;
110-
bool hasNameRegex(StringRef Name) const;
111110
bool nameStartsWith(StringRef Prefix) const;
112111

113112
bool hasSymbol(const MCSymbol *Symbol) const {

bolt/include/bolt/Core/BinaryFunction.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1402,7 +1402,8 @@ class BinaryFunction {
14021402

14031403
/// Return true if the function has CFI instructions
14041404
bool hasCFI() const {
1405-
return !FrameInstructions.empty() || !CIEFrameInstructions.empty();
1405+
return !FrameInstructions.empty() || !CIEFrameInstructions.empty() ||
1406+
IsInjected;
14061407
}
14071408

14081409
/// Return unique number associated with the function.

bolt/include/bolt/Profile/BoltAddressTranslation.h

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
#include <unordered_map>
2020

2121
namespace llvm {
22+
class MCSymbol;
2223
class raw_ostream;
2324

2425
namespace object {
@@ -118,10 +119,12 @@ class BoltAddressTranslation {
118119
/// True if a given \p Address is a function with translation table entry.
119120
bool isBATFunction(uint64_t Address) const { return Maps.count(Address); }
120121

121-
/// Returns branch offsets grouped by containing basic block in a given
122-
/// function.
123-
std::unordered_map<uint32_t, std::vector<uint32_t>>
124-
getBFBranches(uint64_t FuncOutputAddress) const;
122+
/// For a given \p Symbol in the output binary and known \p InputOffset
123+
/// return a corresponding pair of parent BinaryFunction and secondary entry
124+
/// point in it.
125+
std::pair<const BinaryFunction *, unsigned>
126+
translateSymbol(const BinaryContext &BC, const MCSymbol &Symbol,
127+
uint32_t InputOffset) const;
125128

126129
private:
127130
/// Helper to update \p Map by inserting one or more BAT entries reflecting
@@ -146,9 +149,9 @@ class BoltAddressTranslation {
146149
/// entries in function address translation map.
147150
APInt calculateBranchEntriesBitMask(MapTy &Map, size_t EqualElems);
148151

149-
/// Calculate the number of equal offsets (output = input) in the beginning
150-
/// of the function.
151-
size_t getNumEqualOffsets(const MapTy &Map) const;
152+
/// Calculate the number of equal offsets (output = input - skew) in the
153+
/// beginning of the function.
154+
size_t getNumEqualOffsets(const MapTy &Map, uint32_t Skew) const;
152155

153156
std::map<uint64_t, MapTy> Maps;
154157

@@ -158,6 +161,10 @@ class BoltAddressTranslation {
158161
/// Map a function to its secondary entry points vector
159162
std::unordered_map<uint64_t, std::vector<uint32_t>> SecondaryEntryPointsMap;
160163

164+
/// Return a secondary entry point ID for a function located at \p Address and
165+
/// \p Offset within that function.
166+
unsigned getSecondaryEntryPointId(uint64_t Address, uint32_t Offset) const;
167+
161168
/// Links outlined cold bocks to their original function
162169
std::map<uint64_t, uint64_t> ColdPartSource;
163170

@@ -181,7 +188,7 @@ class BoltAddressTranslation {
181188
EntryTy(unsigned Index, size_t Hash) : Index(Index), Hash(Hash) {}
182189
};
183190

184-
std::unordered_map<uint32_t, EntryTy> Map;
191+
std::map<uint32_t, EntryTy> Map;
185192
const EntryTy &getEntry(uint32_t BBInputOffset) const {
186193
auto It = Map.find(BBInputOffset);
187194
assert(It != Map.end());
@@ -206,6 +213,10 @@ class BoltAddressTranslation {
206213
}
207214

208215
size_t getNumBasicBlocks() const { return Map.size(); }
216+
217+
auto begin() const { return Map.begin(); }
218+
auto end() const { return Map.end(); }
219+
auto upper_bound(uint32_t Offset) const { return Map.upper_bound(Offset); }
209220
};
210221

211222
/// Map function output address to its hash and basic blocks hash map.

bolt/include/bolt/Profile/DataAggregator.h

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,10 @@ class DataAggregator : public DataReader {
225225
/// Aggregation statistics
226226
uint64_t NumInvalidTraces{0};
227227
uint64_t NumLongRangeTraces{0};
228+
/// Specifies how many samples were recorded in cold areas if we are dealing
229+
/// with profiling data collected in a bolted binary. For LBRs, incremented
230+
/// for the source of the branch to avoid counting cold activity twice (one
231+
/// for source and another for destination).
228232
uint64_t NumColdSamples{0};
229233

230234
/// Looks into system PATH for Linux Perf and set up the aggregator to use it
@@ -245,14 +249,12 @@ class DataAggregator : public DataReader {
245249
/// disassembled BinaryFunctions
246250
BinaryFunction *getBinaryFunctionContainingAddress(uint64_t Address) const;
247251

252+
/// Perform BAT translation for a given \p Func and return the parent
253+
/// BinaryFunction or nullptr.
254+
BinaryFunction *getBATParentFunction(const BinaryFunction &Func) const;
255+
248256
/// Retrieve the location name to be used for samples recorded in \p Func.
249-
/// If doing BAT translation, link cold parts to the hot part names (used by
250-
/// the original binary). \p Count specifies how many samples were recorded
251-
/// at that location, so we can tally total activity in cold areas if we are
252-
/// dealing with profiling data collected in a bolted binary. For LBRs,
253-
/// \p Count should only be used for the source of the branch to avoid
254-
/// counting cold activity twice (one for source and another for destination).
255-
StringRef getLocationName(BinaryFunction &Func, uint64_t Count);
257+
StringRef getLocationName(const BinaryFunction &Func) const;
256258

257259
/// Semantic actions - parser hooks to interpret parsed perf samples
258260
/// Register a sample (non-LBR mode), i.e. a new hit at \p Address
@@ -467,9 +469,6 @@ class DataAggregator : public DataReader {
467469
std::error_code writeBATYAML(BinaryContext &BC,
468470
StringRef OutputFilename) const;
469471

470-
/// Fixup profile collected on BOLTed binary, namely handle split functions.
471-
void fixupBATProfile(BinaryContext &BC);
472-
473472
/// Filter out binaries based on PID
474473
void filterBinaryMMapInfo();
475474

bolt/include/bolt/Profile/YAMLProfileWriter.h

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515

1616
namespace llvm {
1717
namespace bolt {
18+
class BoltAddressTranslation;
1819
class RewriteInstance;
1920

2021
class YAMLProfileWriter {
@@ -31,8 +32,16 @@ class YAMLProfileWriter {
3132
/// Save execution profile for that instance.
3233
std::error_code writeProfile(const RewriteInstance &RI);
3334

34-
static yaml::bolt::BinaryFunctionProfile convert(const BinaryFunction &BF,
35-
bool UseDFS);
35+
static yaml::bolt::BinaryFunctionProfile
36+
convert(const BinaryFunction &BF, bool UseDFS,
37+
const BoltAddressTranslation *BAT = nullptr);
38+
39+
/// Set CallSiteInfo destination fields from \p Symbol and return a target
40+
/// BinaryFunction for that symbol.
41+
static const BinaryFunction *
42+
setCSIDestination(const BinaryContext &BC, yaml::bolt::CallSiteInfo &CSI,
43+
const MCSymbol *Symbol, const BoltAddressTranslation *BAT,
44+
uint32_t Offset = 0);
3645
};
3746

3847
} // namespace bolt

bolt/include/bolt/Rewrite/RewriteInstance.h

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -368,13 +368,6 @@ class RewriteInstance {
368368
/// rewritten binary.
369369
void patchBuildID();
370370

371-
/// Return file offset corresponding to a given virtual address.
372-
uint64_t getFileOffsetFor(uint64_t Address) {
373-
assert(Address >= NewTextSegmentAddress &&
374-
"address in not in the new text segment");
375-
return Address - NewTextSegmentAddress + NewTextSegmentOffset;
376-
}
377-
378371
/// Return file offset corresponding to a virtual \p Address.
379372
/// Return 0 if the address has no mapping in the file, including being
380373
/// part of .bss section.
@@ -398,9 +391,6 @@ class RewriteInstance {
398391
/// Return true if the section holds debug information.
399392
static bool isDebugSection(StringRef SectionName);
400393

401-
/// Return true if the section holds linux kernel symbol information.
402-
static bool isKSymtabSection(StringRef SectionName);
403-
404394
/// Adds Debug section to overwrite.
405395
static void addToDebugSectionsToOverwrite(const char *Section) {
406396
DebugSectionsToOverwrite.emplace_back(Section);

0 commit comments

Comments
 (0)