Skip to content

Commit 49dc5d5

Browse files
committed
Merge remote-tracking branch 'origin/main' into vplan-for-hoist
2 parents 63424ba + e674424 commit 49dc5d5

File tree

867 files changed

+37261
-22528
lines changed

Some content is hidden

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

867 files changed

+37261
-22528
lines changed

.gitattributes

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
# Checkout as native, commit as LF except in specific circumstances
2+
* text=auto
3+
*.bat text eol=crlf
4+
*.rc text eol=crlf
5+
*.sln text eol=crlf
6+
*.natvis text eol=crlf
7+
18
libcxx/src/**/*.cpp merge=libcxx-reformat
29
libcxx/include/**/*.h merge=libcxx-reformat
310

bolt/lib/Passes/LongJmp.cpp

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -324,9 +324,8 @@ uint64_t LongJmpPass::tentativeLayoutRelocColdPart(
324324
uint64_t LongJmpPass::tentativeLayoutRelocMode(
325325
const BinaryContext &BC, std::vector<BinaryFunction *> &SortedFunctions,
326326
uint64_t DotAddress) {
327-
328327
// Compute hot cold frontier
329-
uint32_t LastHotIndex = -1u;
328+
int64_t LastHotIndex = -1u;
330329
uint32_t CurrentIndex = 0;
331330
if (opts::HotFunctionsAtEnd) {
332331
for (BinaryFunction *BF : SortedFunctions) {
@@ -351,19 +350,20 @@ uint64_t LongJmpPass::tentativeLayoutRelocMode(
351350
// Hot
352351
CurrentIndex = 0;
353352
bool ColdLayoutDone = false;
353+
auto runColdLayout = [&]() {
354+
DotAddress = tentativeLayoutRelocColdPart(BC, SortedFunctions, DotAddress);
355+
ColdLayoutDone = true;
356+
if (opts::HotFunctionsAtEnd)
357+
DotAddress = alignTo(DotAddress, opts::AlignText);
358+
};
354359
for (BinaryFunction *Func : SortedFunctions) {
355360
if (!BC.shouldEmit(*Func)) {
356361
HotAddresses[Func] = Func->getAddress();
357362
continue;
358363
}
359364

360-
if (!ColdLayoutDone && CurrentIndex >= LastHotIndex) {
361-
DotAddress =
362-
tentativeLayoutRelocColdPart(BC, SortedFunctions, DotAddress);
363-
ColdLayoutDone = true;
364-
if (opts::HotFunctionsAtEnd)
365-
DotAddress = alignTo(DotAddress, opts::AlignText);
366-
}
365+
if (!ColdLayoutDone && CurrentIndex >= LastHotIndex)
366+
runColdLayout();
367367

368368
DotAddress = alignTo(DotAddress, Func->getMinAlignment());
369369
uint64_t Pad =
@@ -382,6 +382,11 @@ uint64_t LongJmpPass::tentativeLayoutRelocMode(
382382
DotAddress += Func->estimateConstantIslandSize();
383383
++CurrentIndex;
384384
}
385+
386+
// Ensure that tentative code layout always runs for cold blocks.
387+
if (!ColdLayoutDone)
388+
runColdLayout();
389+
385390
// BBs
386391
for (BinaryFunction *Func : SortedFunctions)
387392
tentativeBBLayout(*Func);
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# This test checks that tentative code layout for cold blocks always runs.
2+
# It commonly happens when using lite mode with split functions.
3+
4+
# REQUIRES: system-linux, asserts
5+
6+
# RUN: %clang %cflags -o %t %s
7+
# RUN: %clang %s %cflags -Wl,-q -o %t
8+
# RUN: link_fdata --no-lbr %s %t %t.fdata
9+
# RUN: llvm-bolt %t -o %t.bolt --data %t.fdata -split-functions \
10+
# RUN: -debug 2>&1 | FileCheck %s
11+
12+
.text
13+
.globl foo
14+
.type foo, %function
15+
foo:
16+
.entry_bb:
17+
# FDATA: 1 foo #.entry_bb# 10
18+
cmp x0, #0
19+
b.eq .Lcold_bb1
20+
ret
21+
.Lcold_bb1:
22+
ret
23+
24+
## Force relocation mode.
25+
.reloc 0, R_AARCH64_NONE
26+
27+
# CHECK: foo{{.*}} cold tentative: {{.*}}

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -458,7 +458,6 @@ ClangTidyASTConsumerFactory::createASTConsumer(
458458
if (!AnalyzerOptions.CheckersAndPackages.empty()) {
459459
setStaticAnalyzerCheckerOpts(Context.getOptions(), AnalyzerOptions);
460460
AnalyzerOptions.AnalysisDiagOpt = PD_NONE;
461-
AnalyzerOptions.eagerlyAssumeBinOpBifurcation = true;
462461
std::unique_ptr<ento::AnalysisASTConsumer> AnalysisConsumer =
463462
ento::CreateAnalysisConsumer(Compiler);
464463
AnalysisConsumer->AddDiagnosticConsumer(

clang-tools-extra/clang-tidy/misc/UseInternalLinkageCheck.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,15 @@
88

99
#include "UseInternalLinkageCheck.h"
1010
#include "../utils/FileExtensionsUtils.h"
11+
#include "../utils/LexerUtils.h"
1112
#include "clang/AST/Decl.h"
1213
#include "clang/ASTMatchers/ASTMatchFinder.h"
1314
#include "clang/ASTMatchers/ASTMatchers.h"
1415
#include "clang/ASTMatchers/ASTMatchersMacros.h"
1516
#include "clang/Basic/SourceLocation.h"
1617
#include "clang/Basic/Specifiers.h"
18+
#include "clang/Basic/TokenKinds.h"
19+
#include "clang/Lex/Token.h"
1720
#include "llvm/ADT/STLExtras.h"
1821

1922
using namespace clang::ast_matchers;
@@ -113,7 +116,7 @@ static constexpr StringRef Message =
113116
void UseInternalLinkageCheck::check(const MatchFinder::MatchResult &Result) {
114117
if (const auto *FD = Result.Nodes.getNodeAs<FunctionDecl>("fn")) {
115118
DiagnosticBuilder DB = diag(FD->getLocation(), Message) << "function" << FD;
116-
SourceLocation FixLoc = FD->getTypeSpecStartLoc();
119+
const SourceLocation FixLoc = FD->getInnerLocStart();
117120
if (FixLoc.isInvalid() || FixLoc.isMacroID())
118121
return;
119122
if (FixMode == FixModeKind::UseStatic)
@@ -128,7 +131,7 @@ void UseInternalLinkageCheck::check(const MatchFinder::MatchResult &Result) {
128131
return;
129132

130133
DiagnosticBuilder DB = diag(VD->getLocation(), Message) << "variable" << VD;
131-
SourceLocation FixLoc = VD->getTypeSpecStartLoc();
134+
const SourceLocation FixLoc = VD->getInnerLocStart();
132135
if (FixLoc.isInvalid() || FixLoc.isMacroID())
133136
return;
134137
if (FixMode == FixModeKind::UseStatic)

clang-tools-extra/clang-tidy/utils/LexerUtils.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,15 @@ getPreviousTokenAndStart(SourceLocation Location, const SourceManager &SM,
2424
if (Location.isInvalid())
2525
return {Token, Location};
2626

27-
auto StartOfFile = SM.getLocForStartOfFile(SM.getFileID(Location));
27+
const auto StartOfFile = SM.getLocForStartOfFile(SM.getFileID(Location));
2828
while (Location != StartOfFile) {
2929
Location = Lexer::GetBeginningOfToken(Location, SM, LangOpts);
3030
if (!Lexer::getRawToken(Location, Token, SM, LangOpts) &&
3131
(!SkipComments || !Token.is(tok::comment))) {
3232
break;
3333
}
34+
if (Location == StartOfFile)
35+
return {Token, Location};
3436
Location = Location.getLocWithOffset(-1);
3537
}
3638
return {Token, Location};
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
input-mirror.test text eol=crlf
2+
too_large.test text eol=crlf
3+
protocol.test text eol=crlf
Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
1-
# RUN: clangd -pretty -sync -input-mirror-file %t < %s
2-
# Note that we have to use '-b' as -input-mirror-file does not have a newline at the end of file.
3-
# RUN: diff -b %t %s
4-
# It is absolutely vital that this file has CRLF line endings.
5-
#
6-
Content-Length: 125
7-
8-
{"jsonrpc":"2.0","id":0,"method":"initialize","params":{"processId":123,"rootPath":"clangd","capabilities":{},"trace":"off"}}
9-
Content-Length: 172
10-
11-
{"jsonrpc":"2.0","method":"textDocument/didOpen","params":{"textDocument":{"uri":"test:///main.cpp","languageId":"cpp","version":1,"text":"int main() {\nint a;\na;\n}\n"}}}
12-
Content-Length: 44
13-
14-
{"jsonrpc":"2.0","id":3,"method":"shutdown"}
15-
Content-Length: 33
16-
17-
{"jsonrpc":"2.0","method":"exit"}
1+
# RUN: clangd -pretty -sync -input-mirror-file %t < %s
2+
# Note that we have to use '-b' as -input-mirror-file does not have a newline at the end of file.
3+
# RUN: diff -b %t %s
4+
# It is absolutely vital that this file has CRLF line endings.
5+
#
6+
Content-Length: 125
7+
8+
{"jsonrpc":"2.0","id":0,"method":"initialize","params":{"processId":123,"rootPath":"clangd","capabilities":{},"trace":"off"}}
9+
Content-Length: 172
10+
11+
{"jsonrpc":"2.0","method":"textDocument/didOpen","params":{"textDocument":{"uri":"test:///main.cpp","languageId":"cpp","version":1,"text":"int main() {\nint a;\na;\n}\n"}}}
12+
Content-Length: 44
13+
14+
{"jsonrpc":"2.0","id":3,"method":"shutdown"}
15+
Content-Length: 33
16+
17+
{"jsonrpc":"2.0","method":"exit"}

0 commit comments

Comments
 (0)