Skip to content

Commit 72abbc0

Browse files
committed
Merge from 'main' to 'sycl-web' (63 commits)
CONFLICT (content): Merge conflict in llvm/lib/Analysis/ValueTracking.cpp
2 parents f25f364 + 2e165a2 commit 72abbc0

File tree

174 files changed

+5200
-1820
lines changed

Some content is hidden

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

174 files changed

+5200
-1820
lines changed
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: PR Request Release Note
2+
3+
permissions:
4+
contents: read
5+
pull-requests: write
6+
7+
on:
8+
pull_request:
9+
types:
10+
- closed
11+
12+
jobs:
13+
request-release-note:
14+
if: >-
15+
github.repository_owner == 'llvm' &&
16+
startsWith(github.ref, 'refs/heads/release')
17+
18+
runs-on: ubuntu-latest
19+
steps:
20+
# We need to pull the script from the main branch, so that we ensure
21+
# we get the latest version of this script.
22+
- name: Checkout Scripts
23+
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
24+
with:
25+
sparse-checkout: |
26+
llvm/utils/git/requirements.txt
27+
llvm/utils/git/github-automation.py
28+
sparse-checkout-cone-mode: false
29+
30+
- name: Install Dependencies
31+
run: |
32+
pip install -r llvm/utils/git/requirements.txt
33+
34+
- name: Request Release Note
35+
env:
36+
# We need to use an llvmbot token here, because we are mentioning a user.
37+
GITHUB_TOKEN: ${{ github.token }}
38+
run: |
39+
python3 llvm/utils/git/github-automation.py \
40+
--repo "$GITHUB_REPOSITORY" \
41+
--token "$GITHUB_TOKEN" \
42+
request-release-note \
43+
--pr-number ${{ github.event.pull_request.number}}

bolt/lib/Profile/DataAggregator.cpp

Lines changed: 20 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -2355,30 +2355,6 @@ std::error_code DataAggregator::writeBATYAML(BinaryContext &BC,
23552355
for (auto BI = BlockMap.begin(), BE = BlockMap.end(); BI != BE; ++BI)
23562356
YamlBF.Blocks[BI->second.getBBIndex()].Hash = BI->second.getBBHash();
23572357

2358-
auto getSuccessorInfo = [&](uint32_t SuccOffset, unsigned SuccDataIdx) {
2359-
const llvm::bolt::BranchInfo &BI = Branches.Data.at(SuccDataIdx);
2360-
yaml::bolt::SuccessorInfo SI;
2361-
SI.Index = BlockMap.getBBIndex(SuccOffset);
2362-
SI.Count = BI.Branches;
2363-
SI.Mispreds = BI.Mispreds;
2364-
return SI;
2365-
};
2366-
2367-
auto getCallSiteInfo = [&](Location CallToLoc, unsigned CallToIdx,
2368-
uint32_t Offset) {
2369-
const llvm::bolt::BranchInfo &BI = Branches.Data.at(CallToIdx);
2370-
yaml::bolt::CallSiteInfo CSI;
2371-
CSI.DestId = 0; // designated for unknown functions
2372-
CSI.EntryDiscriminator = 0;
2373-
CSI.Count = BI.Branches;
2374-
CSI.Mispreds = BI.Mispreds;
2375-
CSI.Offset = Offset;
2376-
if (BinaryData *BD = BC.getBinaryDataByName(CallToLoc.Name))
2377-
YAMLProfileWriter::setCSIDestination(BC, CSI, BD->getSymbol(), BAT,
2378-
CallToLoc.Offset);
2379-
return CSI;
2380-
};
2381-
23822358
// Lookup containing basic block offset and index
23832359
auto getBlock = [&BlockMap](uint32_t Offset) {
23842360
auto BlockIt = BlockMap.upper_bound(Offset);
@@ -2390,25 +2366,26 @@ std::error_code DataAggregator::writeBATYAML(BinaryContext &BC,
23902366
return std::pair(BlockIt->first, BlockIt->second.getBBIndex());
23912367
};
23922368

2393-
for (const auto &[FromOffset, SuccKV] : Branches.IntraIndex) {
2394-
const auto &[_, Index] = getBlock(FromOffset);
2395-
yaml::bolt::BinaryBasicBlockProfile &YamlBB = YamlBF.Blocks[Index];
2396-
for (const auto &[SuccOffset, SuccDataIdx] : SuccKV)
2397-
if (BlockMap.isInputBlock(SuccOffset))
2398-
YamlBB.Successors.emplace_back(
2399-
getSuccessorInfo(SuccOffset, SuccDataIdx));
2400-
}
2401-
for (const auto &[FromOffset, CallTo] : Branches.InterIndex) {
2402-
const auto &[BlockOffset, BlockIndex] = getBlock(FromOffset);
2403-
yaml::bolt::BinaryBasicBlockProfile &YamlBB = YamlBF.Blocks[BlockIndex];
2404-
const uint32_t Offset = FromOffset - BlockOffset;
2405-
for (const auto &[CallToLoc, CallToIdx] : CallTo)
2406-
YamlBB.CallSites.emplace_back(
2407-
getCallSiteInfo(CallToLoc, CallToIdx, Offset));
2408-
llvm::sort(YamlBB.CallSites, [](yaml::bolt::CallSiteInfo &A,
2409-
yaml::bolt::CallSiteInfo &B) {
2410-
return A.Offset < B.Offset;
2411-
});
2369+
for (const llvm::bolt::BranchInfo &BI : Branches.Data) {
2370+
using namespace yaml::bolt;
2371+
const auto &[BlockOffset, BlockIndex] = getBlock(BI.From.Offset);
2372+
BinaryBasicBlockProfile &YamlBB = YamlBF.Blocks[BlockIndex];
2373+
if (BI.To.IsSymbol && BI.To.Name == BI.From.Name && BI.To.Offset != 0) {
2374+
// Internal branch
2375+
const unsigned SuccIndex = getBlock(BI.To.Offset).second;
2376+
auto &SI = YamlBB.Successors.emplace_back(SuccessorInfo{SuccIndex});
2377+
SI.Count = BI.Branches;
2378+
SI.Mispreds = BI.Mispreds;
2379+
} else {
2380+
// Call
2381+
const uint32_t Offset = BI.From.Offset - BlockOffset;
2382+
auto &CSI = YamlBB.CallSites.emplace_back(CallSiteInfo{Offset});
2383+
CSI.Count = BI.Branches;
2384+
CSI.Mispreds = BI.Mispreds;
2385+
if (const BinaryData *BD = BC.getBinaryDataByName(BI.To.Name))
2386+
YAMLProfileWriter::setCSIDestination(BC, CSI, BD->getSymbol(), BAT,
2387+
BI.To.Offset);
2388+
}
24122389
}
24132390
// Set entry counts, similar to DataReader::readProfile.
24142391
for (const llvm::bolt::BranchInfo &BI : Branches.EntryData) {

bolt/lib/Profile/DataReader.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -775,6 +775,7 @@ bool DataReader::recordBranch(BinaryFunction &BF, uint64_t From, uint64_t To,
775775
if (collectedInBoltedBinary() && FromBB == ToBB)
776776
return true;
777777

778+
// Allow passthrough blocks.
778779
BinaryBasicBlock *FTSuccessor = FromBB->getConditionalSuccessor(false);
779780
if (FTSuccessor && FTSuccessor->succ_size() == 1 &&
780781
FTSuccessor->getSuccessor(ToBB->getLabel())) {

bolt/lib/Profile/YAMLProfileReader.cpp

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -218,17 +218,28 @@ bool YAMLProfileReader::parseFunctionProfile(
218218
continue;
219219
}
220220

221-
BinaryBasicBlock &SuccessorBB = *Order[YamlSI.Index];
222-
if (!BB.getSuccessor(SuccessorBB.getLabel())) {
223-
if (opts::Verbosity >= 1)
224-
errs() << "BOLT-WARNING: no successor for block " << BB.getName()
225-
<< " that matches index " << YamlSI.Index << " or block "
226-
<< SuccessorBB.getName() << '\n';
227-
++MismatchedEdges;
228-
continue;
221+
BinaryBasicBlock *ToBB = Order[YamlSI.Index];
222+
if (!BB.getSuccessor(ToBB->getLabel())) {
223+
// Allow passthrough blocks.
224+
BinaryBasicBlock *FTSuccessor = BB.getConditionalSuccessor(false);
225+
if (FTSuccessor && FTSuccessor->succ_size() == 1 &&
226+
FTSuccessor->getSuccessor(ToBB->getLabel())) {
227+
BinaryBasicBlock::BinaryBranchInfo &FTBI =
228+
FTSuccessor->getBranchInfo(*ToBB);
229+
FTBI.Count += YamlSI.Count;
230+
FTBI.MispredictedCount += YamlSI.Mispreds;
231+
ToBB = FTSuccessor;
232+
} else {
233+
if (opts::Verbosity >= 1)
234+
errs() << "BOLT-WARNING: no successor for block " << BB.getName()
235+
<< " that matches index " << YamlSI.Index << " or block "
236+
<< ToBB->getName() << '\n';
237+
++MismatchedEdges;
238+
continue;
239+
}
229240
}
230241

231-
BinaryBasicBlock::BinaryBranchInfo &BI = BB.getBranchInfo(SuccessorBB);
242+
BinaryBasicBlock::BinaryBranchInfo &BI = BB.getBranchInfo(*ToBB);
232243
BI.Count += YamlSI.Count;
233244
BI.MispredictedCount += YamlSI.Mispreds;
234245
}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
B 800154 401050 20 0
2+
F 800159 800193 7

bolt/test/X86/bolt-address-translation-yaml.test

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,17 @@ BRANCHENTRY-YAML-CHECK: - name: SolveCubic
1515
BRANCHENTRY-YAML-CHECK: bid: 0
1616
BRANCHENTRY-YAML-CHECK: hash: 0x700F19D24600000
1717
BRANCHENTRY-YAML-CHECK-NEXT: succ: [ { bid: 7, cnt: 1 }
18+
# Check that the order is correct between BAT YAML and FDATA->YAML.
19+
RUN: perf2bolt %t.out --pa -p %p/Inputs/blarge_new_bat_order.preagg.txt \
20+
RUN: -w %t.yaml -o %t.fdata
21+
RUN: llvm-bolt %t.exe -data %t.fdata -w %t.yaml-fdata -o %t.null
22+
RUN: FileCheck --input-file %t.yaml --check-prefix ORDER-YAML-CHECK %s
23+
RUN: FileCheck --input-file %t.yaml-fdata --check-prefix ORDER-YAML-CHECK %s
24+
ORDER-YAML-CHECK: - name: SolveCubic
25+
ORDER-YAML-CHECK: bid: 3
26+
ORDER-YAML-CHECK: hash: 0xDDA1DC5F69F900AC
27+
ORDER-YAML-CHECK-NEXT: calls: [ { off: 0x26, fid: [[#]], cnt: 20 } ]
28+
ORDER-YAML-CHECK-NEXT: succ: [ { bid: 5, cnt: 7 }
1829
# Large profile test
1930
RUN: perf2bolt %t.out --pa -p %p/Inputs/blarge_new_bat.preagg.txt -w %t.yaml -o %t.fdata \
2031
RUN: 2>&1 | FileCheck --check-prefix READ-BAT-CHECK %s
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
## Test YAMLProfileReader support for pass-through blocks in non-matching edges:
2+
## match the profile edge A -> C to the CFG with blocks A -> B -> C.
3+
4+
# REQUIRES: system-linux
5+
# RUN: split-file %s %t
6+
# RUN: llvm-mc -filetype=obj -triple x86_64-unknown-unknown %t/main.s -o %t.o
7+
# RUN: %clang %cflags %t.o -o %t.exe -Wl,-q -nostdlib
8+
# RUN: llvm-bolt %t.exe -o %t.out --data %t/yaml --profile-ignore-hash -v=1 \
9+
# RUN: --print-cfg 2>&1 | FileCheck %s
10+
11+
# CHECK: Binary Function "main" after building cfg
12+
# CHECK: Profile Acc : 100.0%
13+
# CHECK-NOT: BOLT-WARNING: no successor for block .LFT0 that matches index 3 or block .Ltmp0
14+
15+
#--- main.s
16+
.globl main
17+
.type main, @function
18+
main:
19+
.cfi_startproc
20+
.LBB00:
21+
pushq %rbp
22+
movq %rsp, %rbp
23+
subq $16, %rsp
24+
testq %rax, %rax
25+
js .LBB03
26+
.LBB01:
27+
jne .LBB04
28+
.LBB02:
29+
nop
30+
.LBB03:
31+
xorl %eax, %eax
32+
addq $16, %rsp
33+
popq %rbp
34+
retq
35+
.LBB04:
36+
xorl %eax, %eax
37+
addq $16, %rsp
38+
popq %rbp
39+
retq
40+
## For relocations against .text
41+
.LBB05:
42+
call exit
43+
.cfi_endproc
44+
.size main, .-main
45+
46+
#--- yaml
47+
---
48+
header:
49+
profile-version: 1
50+
binary-name: 'profile-passthrough-block.s.tmp.exe'
51+
binary-build-id: '<unknown>'
52+
profile-flags: [ lbr ]
53+
profile-origin: branch profile reader
54+
profile-events: ''
55+
dfs-order: false
56+
hash-func: xxh3
57+
functions:
58+
- name: main
59+
fid: 0
60+
hash: 0x0000000000000000
61+
exec: 1
62+
nblocks: 6
63+
blocks:
64+
- bid: 1
65+
insns: 1
66+
succ: [ { bid: 3, cnt: 1} ]
67+
...

clang-tools-extra/test/clang-tidy/check_clang_tidy.py

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ def __init__(self, args, extra_args):
9999
self.has_check_fixes = False
100100
self.has_check_messages = False
101101
self.has_check_notes = False
102+
self.expect_no_diagnosis = False
102103
self.export_fixes = args.export_fixes
103104
self.fixes = MessagePrefix("CHECK-FIXES")
104105
self.messages = MessagePrefix("CHECK-MESSAGES")
@@ -172,12 +173,21 @@ def get_prefixes(self):
172173
)
173174

174175
if not has_check_fix and not has_check_message and not has_check_note:
175-
sys.exit(
176-
"%s, %s or %s not found in the input"
177-
% (self.fixes.prefix, self.messages.prefix, self.notes.prefix)
178-
)
176+
self.expect_no_diagnosis = True
179177

180-
assert self.has_check_fixes or self.has_check_messages or self.has_check_notes
178+
expect_diagnosis = (
179+
self.has_check_fixes or self.has_check_messages or self.has_check_notes
180+
)
181+
if self.expect_no_diagnosis and expect_diagnosis:
182+
sys.exit(
183+
"%s, %s or %s not found in the input"
184+
% (
185+
self.fixes.prefix,
186+
self.messages.prefix,
187+
self.notes.prefix,
188+
)
189+
)
190+
assert expect_diagnosis or self.expect_no_diagnosis
181191

182192
def prepare_test_inputs(self):
183193
# Remove the contents of the CHECK lines to avoid CHECKs matching on
@@ -226,6 +236,10 @@ def run_clang_tidy(self):
226236
print("------------------------------------------------------------------")
227237
return clang_tidy_output
228238

239+
def check_no_diagnosis(self, clang_tidy_output):
240+
if clang_tidy_output != "":
241+
sys.exit("No diagnostics were expected, but found the ones above")
242+
229243
def check_fixes(self):
230244
if self.has_check_fixes:
231245
try_run(
@@ -277,7 +291,9 @@ def run(self):
277291
self.get_prefixes()
278292
self.prepare_test_inputs()
279293
clang_tidy_output = self.run_clang_tidy()
280-
if self.export_fixes is None:
294+
if self.expect_no_diagnosis:
295+
self.check_no_diagnosis(clang_tidy_output)
296+
elif self.export_fixes is None:
281297
self.check_fixes()
282298
self.check_messages(clang_tidy_output)
283299
self.check_notes(clang_tidy_output)
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
// RUN: %check_clang_tidy %s misc-unused-using-decls %t
2+
3+
// Verify that we don't generate the warnings on header files.
4+
namespace foo { class Foo {}; }
5+
6+
using foo::Foo;

clang-tools-extra/test/clang-tidy/checkers/misc/unused-using-decls.hxx

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

clang/include/clang/Driver/Driver.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -783,6 +783,9 @@ class Driver {
783783
/// option.
784784
void setDriverMode(StringRef DriverModeValue);
785785

786+
/// Set the resource directory, depending on which driver is being used.
787+
void setResourceDirectory();
788+
786789
/// Parse the \p Args list for LTO options and record the type of LTO
787790
/// compilation based on which -f(no-)?lto(=.*)? option occurs last.
788791
void setLTOMode(const llvm::opt::ArgList &Args);

clang/include/clang/Driver/Options.td

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1929,13 +1929,13 @@ defm apinotes : BoolOption<"f", "apinotes",
19291929
LangOpts<"APINotes">, DefaultFalse,
19301930
PosFlag<SetTrue, [], [ClangOption], "Enable">,
19311931
NegFlag<SetFalse, [], [ClangOption], "Disable">,
1932-
BothFlags<[], [ClangOption, CC1Option], "external API notes support">>,
1932+
BothFlags<[], [ClangOption, CC1Option], " external API notes support">>,
19331933
Group<f_clang_Group>;
19341934
defm apinotes_modules : BoolOption<"f", "apinotes-modules",
19351935
LangOpts<"APINotesModules">, DefaultFalse,
19361936
PosFlag<SetTrue, [], [ClangOption], "Enable">,
19371937
NegFlag<SetFalse, [], [ClangOption], "Disable">,
1938-
BothFlags<[], [ClangOption, CC1Option], "module-based external API notes support">>,
1938+
BothFlags<[], [ClangOption, CC1Option], " module-based external API notes support">>,
19391939
Group<f_clang_Group>;
19401940
def fapinotes_swift_version : Joined<["-"], "fapinotes-swift-version=">,
19411941
Group<f_clang_Group>, Visibility<[ClangOption, CC1Option]>,
@@ -5786,7 +5786,10 @@ def print_prog_name_EQ : Joined<["-", "--"], "print-prog-name=">,
57865786
Visibility<[ClangOption, CLOption]>;
57875787
def print_resource_dir : Flag<["-", "--"], "print-resource-dir">,
57885788
HelpText<"Print the resource directory pathname">,
5789-
Visibility<[ClangOption, CLOption]>;
5789+
HelpTextForVariants<[FlangOption],
5790+
"Print the resource directory pathname that contains lib and "
5791+
"include directories with the runtime libraries and MODULE files.">,
5792+
Visibility<[ClangOption, CLOption, FlangOption]>;
57905793
def print_search_dirs : Flag<["-", "--"], "print-search-dirs">,
57915794
HelpText<"Print the paths used for finding libraries and programs">,
57925795
Visibility<[ClangOption, CLOption]>;

0 commit comments

Comments
 (0)