Skip to content

Commit 5c84b6f

Browse files
committed
Rebase
Created using spr 1.3.5
2 parents 1bb2e50 + e4f03b1 commit 5c84b6f

File tree

244 files changed

+37110
-16571
lines changed

Some content is hidden

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

244 files changed

+37110
-16571
lines changed

.github/workflows/libclang-abi-tests.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ jobs:
130130
sed -i 's/LLVM_[0-9]\+/LLVM_NOVERSION/' $lib-${{ matrix.ref }}.abi
131131
done
132132
- name: Upload ABI file
133-
uses: actions/upload-artifact@v3
133+
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # 4.6.0
134134
with:
135135
name: ${{ matrix.name }}
136136
path: '*${{ matrix.ref }}.abi'
@@ -143,12 +143,12 @@ jobs:
143143
- abi-dump
144144
steps:
145145
- name: Download baseline
146-
uses: actions/download-artifact@v3
146+
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # 4.1.8
147147
with:
148148
name: build-baseline
149149
path: build-baseline
150150
- name: Download latest
151-
uses: actions/download-artifact@v3
151+
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # 4.1.8
152152
with:
153153
name: build-latest
154154
path: build-latest
@@ -162,7 +162,7 @@ jobs:
162162
done
163163
- name: Upload ABI Comparison
164164
if: always()
165-
uses: actions/upload-artifact@v3
165+
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # 4.6.0
166166
with:
167167
name: compat-report-${{ github.sha }}
168168
path: compat_reports/

.github/workflows/libcxx-restart-preempted-jobs.yaml

Lines changed: 30 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,12 @@ jobs:
9292
check_run_id: check_run_id
9393
})
9494
95+
// For temporary debugging purposes to see the structure of the annotations.
96+
console.print(annotations);
97+
98+
has_failed_job = false;
99+
saved_failure_message = null;
100+
95101
for (annotation of annotations.data) {
96102
if (annotation.annotation_level != 'failure') {
97103
continue;
@@ -106,15 +112,32 @@ jobs:
106112
107113
const failure_match = annotation.message.match(failure_regex);
108114
if (failure_match != null) {
109-
// We only want to restart the workflow if all of the failures were due to preemption.
110-
// We don't want to restart the workflow if there were other failures.
111-
core.notice('Choosing not to rerun workflow because we found a non-preemption failure' +
112-
'Failure message: "' + annotation.message + '"');
113-
await create_check_run('skipped', 'Choosing not to rerun workflow because we found a non-preemption failure\n'
114-
+ 'Failure message: ' + annotation.message)
115-
return;
115+
has_failed_job = true;
116+
saved_failure_message = annotation.message;
116117
}
117118
}
119+
if (has_failed_job && (! has_preempted_job)) {
120+
// We only want to restart the workflow if all of the failures were due to preemption.
121+
// We don't want to restart the workflow if there were other failures.
122+
//
123+
// However, libcxx runners running inside docker containers produce both a preemption message and failure message.
124+
//
125+
// The desired approach is to ignore failure messages which appear on the same job as a preemption message
126+
// (An job is a single run with a specific configuration, ex generic-gcc, gcc-14).
127+
//
128+
// However, it's unclear that this code achieves the desired approach, and it may ignore all failures
129+
// if a preemption message is found at all on any run.
130+
//
131+
// For now, it's more important to restart preempted workflows than to avoid restarting workflows with
132+
// non-preemption failures.
133+
//
134+
// TODO Figure this out.
135+
core.notice('Choosing not to rerun workflow because we found a non-preemption failure' +
136+
'Failure message: "' + saved_failure_message + '"');
137+
await create_check_run('skipped', 'Choosing not to rerun workflow because we found a non-preemption failure\n'
138+
+ 'Failure message: ' + saved_failure_message)
139+
return;
140+
}
118141
}
119142
120143
if (!has_preempted_job) {

.github/workflows/llvm-tests.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -137,14 +137,14 @@ jobs:
137137
# Remove symbol versioning from dumps, so we can compare across major versions.
138138
sed -i 's/LLVM_${{ matrix.llvm_version_major }}/LLVM_NOVERSION/' ${{ matrix.ref }}.abi
139139
- name: Upload ABI file
140-
uses: actions/upload-artifact@v3
140+
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # 4.6.0
141141
with:
142142
name: ${{ matrix.name }}
143143
path: ${{ matrix.ref }}.abi
144144

145145
- name: Upload symbol list file
146146
if: matrix.name == 'build-baseline'
147-
uses: actions/upload-artifact@v3
147+
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # 4.6.0
148148
with:
149149
name: symbol-list
150150
path: llvm.symbols
@@ -157,17 +157,17 @@ jobs:
157157
- abi-dump
158158
steps:
159159
- name: Download baseline
160-
uses: actions/download-artifact@v3
160+
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # 4.1.8
161161
with:
162162
name: build-baseline
163163
path: build-baseline
164164
- name: Download latest
165-
uses: actions/download-artifact@v3
165+
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # 4.1.8
166166
with:
167167
name: build-latest
168168
path: build-latest
169169
- name: Download symbol list
170-
uses: actions/download-artifact@v3
170+
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # 4.1.8
171171
with:
172172
name: symbol-list
173173
path: symbol-list
@@ -186,7 +186,7 @@ jobs:
186186
abi-compliance-checker $EXTRA_ARGS -l libLLVM.so -old build-baseline/*.abi -new build-latest/*.abi || test "${{ needs.abi-dump-setup.outputs.ABI_HEADERS }}" = "llvm-c"
187187
- name: Upload ABI Comparison
188188
if: always()
189-
uses: actions/upload-artifact@v3
189+
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # 4.6.0
190190
with:
191191
name: compat-report-${{ github.sha }}
192192
path: compat_reports/

.github/workflows/release-documentation.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ jobs:
5959
./llvm/utils/release/build-docs.sh -release "${{ inputs.release-version }}" -no-doxygen
6060
6161
- name: Create Release Notes Artifact
62-
uses: actions/upload-artifact@v3
62+
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # 4.6.0
6363
with:
6464
name: release-notes
6565
path: docs-build/html-export/

bolt/include/bolt/Profile/DataAggregator.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,6 @@ class DataAggregator : public DataReader {
8080
private:
8181
struct PerfBranchSample {
8282
SmallVector<LBREntry, 32> LBR;
83-
uint64_t PC;
8483
};
8584

8685
struct PerfBasicSample {
@@ -334,9 +333,6 @@ class DataAggregator : public DataReader {
334333
/// Process all branch events.
335334
void processBranchEvents();
336335

337-
/// This member function supports generating data for AutoFDO LLVM tools.
338-
std::error_code writeAutoFDOData(StringRef OutputFilename);
339-
340336
/// Parse the full output generated by perf script to report non-LBR samples.
341337
std::error_code parseBasicEvents();
342338

bolt/lib/Profile/DataAggregator.cpp

Lines changed: 9 additions & 100 deletions
Original file line numberDiff line numberDiff line change
@@ -108,15 +108,6 @@ TimeAggregator("time-aggr",
108108
cl::ZeroOrMore,
109109
cl::cat(AggregatorCategory));
110110

111-
static cl::opt<bool>
112-
UseEventPC("use-event-pc",
113-
cl::desc("use event PC in combination with LBR sampling"),
114-
cl::cat(AggregatorCategory));
115-
116-
static cl::opt<bool> WriteAutoFDOData(
117-
"autofdo", cl::desc("generate autofdo textual data instead of bolt data"),
118-
cl::cat(AggregatorCategory));
119-
120111
} // namespace opts
121112

122113
namespace {
@@ -187,15 +178,13 @@ void DataAggregator::start() {
187178
/*Wait = */false);
188179
} else if (!opts::ITraceAggregation.empty()) {
189180
std::string ItracePerfScriptArgs = llvm::formatv(
190-
"script -F pid,ip,brstack --itrace={0}", opts::ITraceAggregation);
181+
"script -F pid,brstack --itrace={0}", opts::ITraceAggregation);
191182
launchPerfProcess("branch events with itrace", MainEventsPPI,
192183
ItracePerfScriptArgs.c_str(),
193184
/*Wait = */ false);
194185
} else {
195-
launchPerfProcess("branch events",
196-
MainEventsPPI,
197-
"script -F pid,ip,brstack",
198-
/*Wait = */false);
186+
launchPerfProcess("branch events", MainEventsPPI, "script -F pid,brstack",
187+
/*Wait = */ false);
199188
}
200189

201190
// Note: we launch script for mem events regardless of the option, as the
@@ -381,67 +370,6 @@ void DataAggregator::parsePreAggregated() {
381370
}
382371
}
383372

384-
std::error_code DataAggregator::writeAutoFDOData(StringRef OutputFilename) {
385-
outs() << "PERF2BOLT: writing data for autofdo tools...\n";
386-
NamedRegionTimer T("writeAutoFDO", "Processing branch events", TimerGroupName,
387-
TimerGroupDesc, opts::TimeAggregator);
388-
389-
std::error_code EC;
390-
raw_fd_ostream OutFile(OutputFilename, EC, sys::fs::OpenFlags::OF_None);
391-
if (EC)
392-
return EC;
393-
394-
// Format:
395-
// number of unique traces
396-
// from_1-to_1:count_1
397-
// from_2-to_2:count_2
398-
// ......
399-
// from_n-to_n:count_n
400-
// number of unique sample addresses
401-
// addr_1:count_1
402-
// addr_2:count_2
403-
// ......
404-
// addr_n:count_n
405-
// number of unique LBR entries
406-
// src_1->dst_1:count_1
407-
// src_2->dst_2:count_2
408-
// ......
409-
// src_n->dst_n:count_n
410-
411-
const uint64_t FirstAllocAddress = this->BC->FirstAllocAddress;
412-
413-
// AutoFDO addresses are relative to the first allocated loadable program
414-
// segment
415-
auto filterAddress = [&FirstAllocAddress](uint64_t Address) -> uint64_t {
416-
if (Address < FirstAllocAddress)
417-
return 0;
418-
return Address - FirstAllocAddress;
419-
};
420-
421-
OutFile << FallthroughLBRs.size() << "\n";
422-
for (const auto &[Trace, Info] : FallthroughLBRs) {
423-
OutFile << formatv("{0:x-}-{1:x-}:{2}\n", filterAddress(Trace.From),
424-
filterAddress(Trace.To),
425-
Info.InternCount + Info.ExternCount);
426-
}
427-
428-
OutFile << BasicSamples.size() << "\n";
429-
for (const auto [PC, HitCount] : BasicSamples)
430-
OutFile << formatv("{0:x-}:{1}\n", filterAddress(PC), HitCount);
431-
432-
OutFile << BranchLBRs.size() << "\n";
433-
for (const auto &[Trace, Info] : BranchLBRs) {
434-
OutFile << formatv("{0:x-}->{1:x-}:{2}\n", filterAddress(Trace.From),
435-
filterAddress(Trace.To), Info.TakenCount);
436-
}
437-
438-
outs() << "PERF2BOLT: wrote " << FallthroughLBRs.size() << " unique traces, "
439-
<< BasicSamples.size() << " sample addresses and " << BranchLBRs.size()
440-
<< " unique branches to " << OutputFilename << "\n";
441-
442-
return std::error_code();
443-
}
444-
445373
void DataAggregator::filterBinaryMMapInfo() {
446374
if (opts::FilterPID) {
447375
auto MMapInfoIter = BinaryMMapInfo.find(opts::FilterPID);
@@ -583,15 +511,6 @@ Error DataAggregator::preprocessProfile(BinaryContext &BC) {
583511
(opts::BasicAggregation && parseBasicEvents()))
584512
errs() << "PERF2BOLT: failed to parse samples\n";
585513

586-
// We can finish early if the goal is just to generate data for autofdo
587-
if (opts::WriteAutoFDOData) {
588-
if (std::error_code EC = writeAutoFDOData(opts::OutputFilename))
589-
errs() << "Error writing autofdo data to file: " << EC.message() << "\n";
590-
591-
deleteTempFiles();
592-
exit(0);
593-
}
594-
595514
// Special handling for memory events
596515
if (prepareToParse("mem events", MemEventsPPI, MemEventsErrorCallback))
597516
return Error::success();
@@ -1158,14 +1077,6 @@ ErrorOr<DataAggregator::PerfBranchSample> DataAggregator::parseBranchSample() {
11581077
return make_error_code(errc::no_such_process);
11591078
}
11601079

1161-
while (checkAndConsumeFS()) {
1162-
}
1163-
1164-
ErrorOr<uint64_t> PCRes = parseHexField(FieldSeparator, true);
1165-
if (std::error_code EC = PCRes.getError())
1166-
return EC;
1167-
Res.PC = PCRes.get();
1168-
11691080
if (checkAndConsumeNewLine())
11701081
return Res;
11711082

@@ -1472,9 +1383,9 @@ std::error_code DataAggregator::printLBRHeatMap() {
14721383
uint64_t DataAggregator::parseLBRSample(const PerfBranchSample &Sample,
14731384
bool NeedsSkylakeFix) {
14741385
uint64_t NumTraces{0};
1475-
// LBRs are stored in reverse execution order. NextPC refers to the next
1476-
// recorded executed PC.
1477-
uint64_t NextPC = opts::UseEventPC ? Sample.PC : 0;
1386+
// LBRs are stored in reverse execution order. NextLBR refers to the next
1387+
// executed branch record.
1388+
const LBREntry *NextLBR = nullptr;
14781389
uint32_t NumEntry = 0;
14791390
for (const LBREntry &LBR : Sample.LBR) {
14801391
++NumEntry;
@@ -1486,10 +1397,10 @@ uint64_t DataAggregator::parseLBRSample(const PerfBranchSample &Sample,
14861397
// chronological order)
14871398
if (NeedsSkylakeFix && NumEntry <= 2)
14881399
continue;
1489-
if (NextPC) {
1400+
if (NextLBR) {
14901401
// Record fall-through trace.
14911402
const uint64_t TraceFrom = LBR.To;
1492-
const uint64_t TraceTo = NextPC;
1403+
const uint64_t TraceTo = NextLBR->From;
14931404
const BinaryFunction *TraceBF =
14941405
getBinaryFunctionContainingAddress(TraceFrom);
14951406
if (TraceBF && TraceBF->containsAddress(TraceTo)) {
@@ -1524,7 +1435,7 @@ uint64_t DataAggregator::parseLBRSample(const PerfBranchSample &Sample,
15241435
}
15251436
++NumTraces;
15261437
}
1527-
NextPC = LBR.From;
1438+
NextLBR = &LBR;
15281439

15291440
uint64_t From = getBinaryFunctionContainingAddress(LBR.From) ? LBR.From : 0;
15301441
uint64_t To = getBinaryFunctionContainingAddress(LBR.To) ? LBR.To : 0;
@@ -1561,8 +1472,6 @@ std::error_code DataAggregator::parseBranchEvents() {
15611472
++NumSamples;
15621473

15631474
PerfBranchSample &Sample = SampleRes.get();
1564-
if (opts::WriteAutoFDOData)
1565-
++BasicSamples[Sample.PC];
15661475

15671476
if (Sample.LBR.empty()) {
15681477
++NumSamplesNoLBR;

clang-tools-extra/clangd/Hover.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1193,12 +1193,13 @@ void maybeAddSymbolProviders(ParsedAST &AST, HoverInfo &HI,
11931193
include_cleaner::Symbol Sym) {
11941194
trace::Span Tracer("Hover::maybeAddSymbolProviders");
11951195

1196-
const SourceManager &SM = AST.getSourceManager();
11971196
llvm::SmallVector<include_cleaner::Header> RankedProviders =
1198-
include_cleaner::headersForSymbol(Sym, SM, &AST.getPragmaIncludes());
1197+
include_cleaner::headersForSymbol(Sym, AST.getPreprocessor(),
1198+
&AST.getPragmaIncludes());
11991199
if (RankedProviders.empty())
12001200
return;
12011201

1202+
const SourceManager &SM = AST.getSourceManager();
12021203
std::string Result;
12031204
include_cleaner::Includes ConvertedIncludes = convertIncludes(AST);
12041205
for (const auto &P : RankedProviders) {

clang-tools-extra/clangd/index/SymbolCollector.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -888,7 +888,7 @@ void SymbolCollector::setIncludeLocation(const Symbol &S, SourceLocation DefLoc,
888888
// might run while parsing, rather than at the end of a translation unit.
889889
// Hence we see more and more redecls over time.
890890
SymbolProviders[S.ID] =
891-
include_cleaner::headersForSymbol(Sym, SM, Opts.PragmaIncludes);
891+
include_cleaner::headersForSymbol(Sym, *PP, Opts.PragmaIncludes);
892892
}
893893

894894
llvm::StringRef getStdHeader(const Symbol *S, const LangOptions &LangOpts) {

clang-tools-extra/include-cleaner/include/clang-include-cleaner/Analysis.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ std::string fixIncludes(const AnalysisResults &Results,
9090
/// Returned headers are sorted by relevance, first element is the most
9191
/// likely provider for the symbol.
9292
llvm::SmallVector<Header> headersForSymbol(const Symbol &S,
93-
const SourceManager &SM,
93+
const Preprocessor &PP,
9494
const PragmaIncludes *PI);
9595
} // namespace include_cleaner
9696
} // namespace clang

clang-tools-extra/include-cleaner/lib/Analysis.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,15 +64,15 @@ void walkUsed(llvm::ArrayRef<Decl *> ASTRoots,
6464
// FIXME: Most of the work done here is repetitive. It might be useful to
6565
// have a cache/batching.
6666
SymbolReference SymRef{ND, Loc, RT};
67-
return CB(SymRef, headersForSymbol(ND, SM, PI));
67+
return CB(SymRef, headersForSymbol(ND, PP, PI));
6868
});
6969
}
7070
for (const SymbolReference &MacroRef : MacroRefs) {
7171
assert(MacroRef.Target.kind() == Symbol::Macro);
7272
if (!SM.isWrittenInMainFile(SM.getSpellingLoc(MacroRef.RefLocation)) ||
7373
shouldIgnoreMacroReference(PP, MacroRef.Target.macro()))
7474
continue;
75-
CB(MacroRef, headersForSymbol(MacroRef.Target, SM, PI));
75+
CB(MacroRef, headersForSymbol(MacroRef.Target, PP, PI));
7676
}
7777
}
7878

0 commit comments

Comments
 (0)