Skip to content

Commit 68da4d9

Browse files
committed
Merge remote-tracking branch 'upstream/main' into createReadOrMaskedRead-utility
2 parents 0a064df + 1837681 commit 68da4d9

File tree

3,537 files changed

+163085
-56281
lines changed

Some content is hidden

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

3,537 files changed

+163085
-56281
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: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,11 +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
117117

118118
# MLIR Python Bindings
119-
/mlir/test/python/ @makslevental @stellaraccident
120-
/mlir/python/ @makslevental @stellaraccident
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
121125

122126
# BOLT
123127
/bolt/ @aaupov @maksfb @rafaelauler @ayermolo @dcci

.github/new-prs-labeler.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -467,6 +467,7 @@ backend:m68k:
467467

468468
libc++:
469469
- libcxx/**
470+
- .github/workflows/libcxx-*
470471

471472
libc++abi:
472473
- libcxxabi/**
@@ -944,3 +945,6 @@ openmp:libomptarget:
944945

945946
bazel:
946947
- utils/bazel/**
948+
949+
offload:
950+
- offload/**

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

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -61,20 +61,17 @@ jobs:
6161
]
6262
cc: [ 'clang-19' ]
6363
cxx: [ 'clang++-19' ]
64-
clang_tidy: [ 'ON' ]
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:
@@ -102,28 +99,23 @@ jobs:
10299
]
103100
cc: [ 'clang-19' ]
104101
cxx: [ 'clang++-19' ]
105-
clang_tidy: [ 'ON' ]
106102
include:
107103
- config: 'generic-gcc-cxx11'
108104
cc: 'gcc-13'
109105
cxx: 'g++-13'
110-
clang_tidy: 'OFF'
111106
- config: 'generic-cxx23'
112107
cc: 'clang-17'
113108
cxx: 'clang++-17'
114-
clang_tidy: 'OFF'
115109
- config: 'generic-cxx26'
116110
cc: 'clang-18'
117111
cxx: 'clang++-18'
118-
clang_tidy: 'ON'
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:
@@ -188,7 +180,6 @@ jobs:
188180
env:
189181
CC: clang-19
190182
CXX: clang++-19
191-
ENABLE_CLANG_TIDY: "OFF"
192183
- uses: actions/upload-artifact@26f96dfa697d77e81fd5907df203aa23a56210a8 # v4.3.0
193184
if: always()
194185
with:

bolt/include/bolt/Rewrite/RewriteInstance.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -426,6 +426,9 @@ class RewriteInstance {
426426
static StringRef getEHFrameSectionName() { return ".eh_frame"; }
427427
static StringRef getRelaDynSectionName() { return ".rela.dyn"; }
428428

429+
/// FILE symbol name used for local fragments of global functions.
430+
static StringRef getBOLTFileSymbolName() { return "bolt-pseudo.o"; }
431+
429432
/// An instance of the input binary we are processing, externally owned.
430433
llvm::object::ELFObjectFileBase *InputFile;
431434

bolt/lib/Rewrite/RewriteInstance.cpp

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4493,6 +4493,8 @@ void RewriteInstance::updateELFSymbolTable(
44934493
// Symbols for the new symbol table.
44944494
std::vector<ELFSymTy> Symbols;
44954495

4496+
bool EmittedColdFileSymbol = false;
4497+
44964498
auto getNewSectionIndex = [&](uint32_t OldIndex) {
44974499
// For dynamic symbol table, the section index could be wrong on the input,
44984500
// and its value is ignored by the runtime if it's different from
@@ -4551,6 +4553,20 @@ void RewriteInstance::updateELFSymbolTable(
45514553
Symbols.emplace_back(ICFSymbol);
45524554
}
45534555
if (Function.isSplit()) {
4556+
// Prepend synthetic FILE symbol to prevent local cold fragments from
4557+
// colliding with existing symbols with the same name.
4558+
if (!EmittedColdFileSymbol &&
4559+
FunctionSymbol.getBinding() == ELF::STB_GLOBAL) {
4560+
ELFSymTy FileSymbol;
4561+
FileSymbol.st_shndx = ELF::SHN_ABS;
4562+
FileSymbol.st_name = AddToStrTab(getBOLTFileSymbolName());
4563+
FileSymbol.st_value = 0;
4564+
FileSymbol.st_size = 0;
4565+
FileSymbol.st_other = 0;
4566+
FileSymbol.setBindingAndType(ELF::STB_LOCAL, ELF::STT_FILE);
4567+
Symbols.emplace_back(FileSymbol);
4568+
EmittedColdFileSymbol = true;
4569+
}
45544570
for (const FunctionFragment &FF :
45554571
Function.getLayout().getSplitFragments()) {
45564572
if (FF.getAddress()) {
@@ -5432,6 +5448,17 @@ uint64_t RewriteInstance::getNewFunctionOrDataAddress(uint64_t OldAddress) {
54325448
if (BD && BD->isMoved())
54335449
return BD->getOutputAddress();
54345450

5451+
if (const BinaryFunction *BF =
5452+
BC->getBinaryFunctionContainingAddress(OldAddress)) {
5453+
if (BF->isEmitted()) {
5454+
BC->errs() << "BOLT-ERROR: unable to get new address corresponding to "
5455+
"input address 0x"
5456+
<< Twine::utohexstr(OldAddress) << " in function " << *BF
5457+
<< ". Consider adding this function to --skip-funcs=...\n";
5458+
exit(1);
5459+
}
5460+
}
5461+
54355462
return 0;
54365463
}
54375464

bolt/test/AArch64/constant_island_pie_update.s

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
# RUN: llvm-objdump -j .text -d --show-all-symbols %t.relr.bolt | FileCheck %s
1919
# RUN: llvm-objdump -j .text -d %t.relr.bolt | \
2020
# RUN: FileCheck %s --check-prefix=ADDENDCHECK
21-
# RUN: llvm-readelf -rsW %t.relr.bolt | FileCheck --check-prefix=ELFCHECK %s
21+
# RUN: llvm-readelf -rsW %t.relr.bolt | FileCheck --check-prefix=RELRELFCHECK %s
2222
# RUN: llvm-readelf -SW %t.relr.bolt | FileCheck --check-prefix=RELRSZCHECK %s
2323

2424
// Check that the CI value was updated
@@ -51,6 +51,12 @@
5151
# ELFCHECK-NEXT: {{.*}} R_AARCH64_RELATIVE
5252
# ELFCHECK: {{.*}}[[#OFF]] {{.*}} $d
5353

54+
# RELRELFCHECK: $d{{$}}
55+
# RELRELFCHECK-NEXT: $d + 0x8{{$}}
56+
# RELRELFCHECK-NEXT: $d + 0x18{{$}}
57+
# RELRELFCHECK-NEXT: mytextP
58+
# RELRELFCHECK-EMPTY:
59+
5460
// Check that .relr.dyn size is 2 bytes to ensure that last 3 relocations were
5561
// encoded as a bitmap so the total section size for 3 relocations is 2 bytes.
5662
# RELRSZCHECK: .relr.dyn RELR [[#%x,ADDR:]] [[#%x,OFF:]] {{0*}}10

bolt/test/RISCV/unnamed-sym-no-entry.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
/// Verify that the binary indeed contains an unnamed symbol at _start
99
// RUN: llvm-readelf -s %t | FileCheck %s --check-prefix=CHECK-ELF
1010
// CHECK-ELF-DAG: [[#%x,START:]] {{.*}} FUNC GLOBAL DEFAULT [[#%d,SECTION:]] _start{{$}}
11-
// CHECK-ELF-DAG: [[#%x,START]] {{.*}} NOTYPE LOCAL DEFAULT [[#SECTION]] {{$}}
11+
// CHECK-ELF-DAG: [[#%x,START]] {{.*}} NOTYPE LOCAL DEFAULT [[#SECTION]] .L0 {{$}}
1212

1313
/// Verify that BOLT did not create an extra entry point for the unnamed symbol
1414
// RUN: llvm-bolt -o %t.bolt %t --print-cfg | FileCheck %s

bolt/test/X86/cdsplit-symbol-names.s

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
# RUN: --call-scale=2 --data=%t.fdata --reorder-blocks=ext-tsp
1111
# RUN: llvm-objdump --syms %t.bolt | FileCheck %s --check-prefix=CHECK-SYMS-WARM
1212

13+
# CHECK-SYMS-WARM: 0000000000000000 l df *ABS* 0000000000000000 bolt-pseudo.o
1314
# CHECK-SYMS-WARM: .text.warm
1415
# CHECK-SYMS-WARM-SAME: chain.warm
1516
# CHECK-SYMS-WARM: .text.cold

bolt/test/X86/indirect-goto-pie.test

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Check that llvm-bolt fails to process PIC binaries with computed goto, as the
2+
# support is not there yet for correctly updating dynamic relocations
3+
# referencing code inside functions.
4+
5+
REQUIRES: x86_64-linux
6+
7+
RUN: %clang %S/Inputs/indirect_goto.c -o %t -fpic -pie -Wl,-q
8+
RUN: not llvm-bolt %t -o %t.bolt --relocs=1 --print-cfg --print-only=main \
9+
RUN: |& FileCheck %s
10+
11+
# Check that processing works if main() is skipped.
12+
RUN: llvm-bolt %t -o %t.bolt --relocs=1 --skip-funcs=main
13+
14+
CHECK: jmpq *%rax # UNKNOWN CONTROL FLOW
15+
16+
CHECK: BOLT-ERROR: unable to get new address

bolt/test/X86/shrinkwrapping-do-not-pessimize.s

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,6 @@ end_if_1:
5353
.size _start, .-_start
5454

5555
.data
56-
rel: .quad end_if_1
56+
rel: .quad _start
5757

5858
# CHECK: BOLT-INFO: Shrink wrapping moved 0 spills inserting load/stores and 0 spills inserting push/pops

bolt/test/runtime/X86/Inputs/indirect_goto.c

Lines changed: 0 additions & 18 deletions
This file was deleted.

bolt/test/runtime/X86/indirect-goto-pie.test

Lines changed: 0 additions & 10 deletions
This file was deleted.

clang-tools-extra/clang-doc/Representation.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -380,8 +380,8 @@ ClangDocContext::ClangDocContext(tooling::ExecutionContext *ECtx,
380380
this->SourceRoot = std::string(SourceRootDir);
381381
if (!RepositoryUrl.empty()) {
382382
this->RepositoryUrl = std::string(RepositoryUrl);
383-
if (!RepositoryUrl.empty() && RepositoryUrl.find("http://") != 0 &&
384-
RepositoryUrl.find("https://") != 0)
383+
if (!RepositoryUrl.empty() && !RepositoryUrl.starts_with("http://") &&
384+
!RepositoryUrl.starts_with("https://"))
385385
this->RepositoryUrl->insert(0, "https://");
386386
}
387387
}

clang-tools-extra/clang-tidy/ClangTidyCheck.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,12 @@ void ClangTidyCheck::OptionsView::storeInt(ClangTidyOptions::OptionMap &Options,
139139
store(Options, LocalName, llvm::itostr(Value));
140140
}
141141

142+
void ClangTidyCheck::OptionsView::storeUnsigned(
143+
ClangTidyOptions::OptionMap &Options, StringRef LocalName,
144+
uint64_t Value) const {
145+
store(Options, LocalName, llvm::utostr(Value));
146+
}
147+
142148
template <>
143149
void ClangTidyCheck::OptionsView::store<bool>(
144150
ClangTidyOptions::OptionMap &Options, StringRef LocalName,

clang-tools-extra/clang-tidy/ClangTidyCheck.h

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -411,7 +411,10 @@ class ClangTidyCheck : public ast_matchers::MatchFinder::MatchCallback {
411411
std::enable_if_t<std::is_integral_v<T>>
412412
store(ClangTidyOptions::OptionMap &Options, StringRef LocalName,
413413
T Value) const {
414-
storeInt(Options, LocalName, Value);
414+
if constexpr (std::is_signed_v<T>)
415+
storeInt(Options, LocalName, Value);
416+
else
417+
storeUnsigned(Options, LocalName, Value);
415418
}
416419

417420
/// Stores an option with the check-local name \p LocalName with
@@ -422,7 +425,7 @@ class ClangTidyCheck : public ast_matchers::MatchFinder::MatchCallback {
422425
store(ClangTidyOptions::OptionMap &Options, StringRef LocalName,
423426
std::optional<T> Value) const {
424427
if (Value)
425-
storeInt(Options, LocalName, *Value);
428+
store(Options, LocalName, *Value);
426429
else
427430
store(Options, LocalName, "none");
428431
}
@@ -470,6 +473,8 @@ class ClangTidyCheck : public ast_matchers::MatchFinder::MatchCallback {
470473
void storeInt(ClangTidyOptions::OptionMap &Options, StringRef LocalName,
471474
int64_t Value) const;
472475

476+
void storeUnsigned(ClangTidyOptions::OptionMap &Options,
477+
StringRef LocalName, uint64_t Value) const;
473478

474479
std::string NamePrefix;
475480
const ClangTidyOptions::OptionMap &CheckOptions;

clang-tools-extra/clang-tidy/GlobList.cpp

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,17 @@ static bool consumeNegativeIndicator(StringRef &GlobList) {
1919
return GlobList.consume_front("-");
2020
}
2121

22-
// Converts first glob from the comma-separated list of globs to Regex and
23-
// removes it and the trailing comma from the GlobList.
24-
static llvm::Regex consumeGlob(StringRef &GlobList) {
22+
// Extracts the first glob from the comma-separated list of globs,
23+
// removes it and the trailing comma from the GlobList and
24+
// returns the extracted glob.
25+
static llvm::StringRef extractNextGlob(StringRef &GlobList) {
2526
StringRef UntrimmedGlob = GlobList.substr(0, GlobList.find_first_of(",\n"));
2627
StringRef Glob = UntrimmedGlob.trim();
2728
GlobList = GlobList.substr(UntrimmedGlob.size() + 1);
29+
return Glob;
30+
}
31+
32+
static llvm::Regex createRegexFromGlob(StringRef &Glob) {
2833
SmallString<128> RegexText("^");
2934
StringRef MetaChars("()^$|*+?.[]\\{}");
3035
for (char C : Glob) {
@@ -43,7 +48,8 @@ GlobList::GlobList(StringRef Globs, bool KeepNegativeGlobs /* =true */) {
4348
do {
4449
GlobListItem Item;
4550
Item.IsPositive = !consumeNegativeIndicator(Globs);
46-
Item.Regex = consumeGlob(Globs);
51+
Item.Text = extractNextGlob(Globs);
52+
Item.Regex = createRegexFromGlob(Item.Text);
4753
if (Item.IsPositive || KeepNegativeGlobs)
4854
Items.push_back(std::move(Item));
4955
} while (!Globs.empty());

clang-tools-extra/clang-tidy/GlobList.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,12 @@ class GlobList {
4444
struct GlobListItem {
4545
bool IsPositive;
4646
llvm::Regex Regex;
47+
llvm::StringRef Text;
4748
};
4849
SmallVector<GlobListItem, 0> Items;
50+
51+
public:
52+
const SmallVectorImpl<GlobListItem> &getItems() const { return Items; };
4953
};
5054

5155
/// A \p GlobList that caches search results, so that search is performed only

clang-tools-extra/clang-tidy/add_new_check.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ def adapt_module(module_path, module, check_name, check_name_camel):
211211
f.write(check_decl)
212212
else:
213213
match = re.search(
214-
'registerCheck<(.*)> *\( *(?:"([^"]*)")?', line
214+
r'registerCheck<(.*)> *\( *(?:"([^"]*)")?', line
215215
)
216216
prev_line = None
217217
if match:
@@ -383,7 +383,7 @@ def filename_from_module(module_name, check_name):
383383
if stmt_start_pos == -1:
384384
return ""
385385
stmt = code[stmt_start_pos + 1 : stmt_end_pos]
386-
matches = re.search('registerCheck<([^>:]*)>\(\s*"([^"]*)"\s*\)', stmt)
386+
matches = re.search(r'registerCheck<([^>:]*)>\(\s*"([^"]*)"\s*\)', stmt)
387387
if matches and matches[2] == full_check_name:
388388
class_name = matches[1]
389389
if "::" in class_name:
@@ -401,8 +401,8 @@ def filename_from_module(module_name, check_name):
401401
# Examine code looking for a c'tor definition to get the base class name.
402402
def get_base_class(code, check_file):
403403
check_class_name = os.path.splitext(os.path.basename(check_file))[0]
404-
ctor_pattern = check_class_name + "\([^:]*\)\s*:\s*([A-Z][A-Za-z0-9]*Check)\("
405-
matches = re.search("\s+" + check_class_name + "::" + ctor_pattern, code)
404+
ctor_pattern = check_class_name + r"\([^:]*\)\s*:\s*([A-Z][A-Za-z0-9]*Check)\("
405+
matches = re.search(r"\s+" + check_class_name + "::" + ctor_pattern, code)
406406

407407
# The constructor might be inline in the header.
408408
if not matches:
@@ -476,7 +476,7 @@ def process_doc(doc_file):
476476
# Orphan page, don't list it.
477477
return "", ""
478478

479-
match = re.search(".*:http-equiv=refresh: \d+;URL=(.*).html(.*)", content)
479+
match = re.search(r".*:http-equiv=refresh: \d+;URL=(.*).html(.*)", content)
480480
# Is it a redirect?
481481
return check_name, match
482482

@@ -505,7 +505,7 @@ def format_link_alias(doc_file):
505505
ref_begin = ""
506506
ref_end = "_"
507507
else:
508-
redirect_parts = re.search("^\.\./([^/]*)/([^/]*)$", match.group(1))
508+
redirect_parts = re.search(r"^\.\./([^/]*)/([^/]*)$", match.group(1))
509509
title = redirect_parts[1] + "-" + redirect_parts[2]
510510
target = redirect_parts[1] + "/" + redirect_parts[2]
511511
autofix = has_auto_fix(title)

0 commit comments

Comments
 (0)