Skip to content

Commit 4fb61c7

Browse files
committed
count traces in doTrace
Created using spr 1.3.4
2 parents 596821f + 51b63bb commit 4fb61c7

File tree

110 files changed

+2840
-1827
lines changed

Some content is hidden

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

110 files changed

+2840
-1827
lines changed

bolt/lib/Profile/DataAggregator.cpp

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -787,14 +787,15 @@ bool DataAggregator::doTrace(const Trace &Trace, uint64_t Count) {
787787
const uint64_t From = Trace.From, To = Trace.To;
788788
BinaryFunction *FromFunc = getBinaryFunctionContainingAddress(From);
789789
BinaryFunction *ToFunc = getBinaryFunctionContainingAddress(To);
790+
NumTraces += Count;
790791
if (!FromFunc || !ToFunc) {
791792
LLVM_DEBUG(dbgs() << "Out of range trace " << Trace << '\n');
792793
NumLongRangeTraces += Count;
793794
return false;
794795
}
795796
if (FromFunc != ToFunc) {
796-
NumInvalidTraces += Count;
797797
LLVM_DEBUG(dbgs() << "Invalid trace " << Trace << '\n');
798+
NumInvalidTraces += Count;
798799
return false;
799800
}
800801

@@ -1313,10 +1314,6 @@ std::error_code DataAggregator::parseAggregatedLBREntry() {
13131314
TakenBranchInfo TI{(uint64_t)Count, (uint64_t)Mispreds};
13141315
Traces.emplace_back(T, TI);
13151316

1316-
/// Increment trace (fall-through) counter.
1317-
if (Addr[2]->Offset != Trace::BR_ONLY)
1318-
NumTraces += Count;
1319-
13201317
NumTotalSamples += Count;
13211318

13221319
return std::error_code();
@@ -1413,11 +1410,7 @@ void DataAggregator::parseLBRSample(const PerfBranchSample &Sample,
14131410
// chronological order)
14141411
if (NeedsSkylakeFix && NumEntry <= 2)
14151412
continue;
1416-
uint64_t TraceTo = Trace::BR_ONLY;
1417-
if (NextLBR) {
1418-
TraceTo = NextLBR->From;
1419-
++NumTraces;
1420-
}
1413+
uint64_t TraceTo = NextLBR ? NextLBR->From : Trace::BR_ONLY;
14211414
NextLBR = &LBR;
14221415

14231416
TakenBranchInfo &Info = TraceMap[Trace{LBR.From, LBR.To, TraceTo}];

bolt/lib/Target/RISCV/RISCVMCPlusBuilder.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
//
1111
//===----------------------------------------------------------------------===//
1212

13-
#include "MCTargetDesc/RISCVMCExpr.h"
13+
#include "MCTargetDesc/RISCVMCAsmInfo.h"
1414
#include "MCTargetDesc/RISCVMCTargetDesc.h"
1515
#include "bolt/Core/MCPlusBuilder.h"
1616
#include "llvm/BinaryFormat/ELF.h"
@@ -438,12 +438,12 @@ class RISCVMCPlusBuilder : public MCPlusBuilder {
438438
return RISCVMCExpr::create(Expr, ELF::R_RISCV_PCREL_HI20, Ctx);
439439
case ELF::R_RISCV_PCREL_LO12_I:
440440
case ELF::R_RISCV_PCREL_LO12_S:
441-
return RISCVMCExpr::create(Expr, RISCVMCExpr::VK_PCREL_LO, Ctx);
441+
return RISCVMCExpr::create(Expr, RISCV::S_PCREL_LO, Ctx);
442442
case ELF::R_RISCV_HI20:
443443
return RISCVMCExpr::create(Expr, ELF::R_RISCV_HI20, Ctx);
444444
case ELF::R_RISCV_LO12_I:
445445
case ELF::R_RISCV_LO12_S:
446-
return RISCVMCExpr::create(Expr, RISCVMCExpr::VK_LO, Ctx);
446+
return RISCVMCExpr::create(Expr, RISCV::S_LO, Ctx);
447447
case ELF::R_RISCV_CALL:
448448
return RISCVMCExpr::create(Expr, ELF::R_RISCV_CALL_PLT, Ctx);
449449
case ELF::R_RISCV_CALL_PLT:

clang-tools-extra/clang-reorder-fields/ReorderFieldsAction.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,10 @@ getNewFieldsOrder(const RecordDecl *Definition,
8686
static void
8787
addReplacement(SourceRange Old, SourceRange New, const ASTContext &Context,
8888
std::map<std::string, tooling::Replacements> &Replacements) {
89+
if (Old.getBegin().isMacroID())
90+
Old = Context.getSourceManager().getExpansionRange(Old).getAsRange();
91+
if (New.getBegin().isMacroID())
92+
New = Context.getSourceManager().getExpansionRange(New).getAsRange();
8993
StringRef NewText =
9094
Lexer::getSourceText(CharSourceRange::getTokenRange(New),
9195
Context.getSourceManager(), Context.getLangOpts());

clang-tools-extra/modularize/CoverageChecker.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -329,10 +329,8 @@ bool CoverageChecker::collectFileSystemHeaders() {
329329
else {
330330
// Otherwise we only look at the sub-trees specified by the
331331
// include paths.
332-
for (std::vector<std::string>::const_iterator I = IncludePaths.begin(),
333-
E = IncludePaths.end();
334-
I != E; ++I) {
335-
if (!collectFileSystemHeaders(*I))
332+
for (const std::string &IncludePath : IncludePaths) {
333+
if (!collectFileSystemHeaders(IncludePath))
336334
return false;
337335
}
338336
}

clang-tools-extra/modularize/Modularize.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -339,8 +339,8 @@ static std::string findInputFile(const CommandLineArguments &CLArgs) {
339339
llvm::opt::Visibility VisibilityMask(options::CC1Option);
340340
unsigned MissingArgIndex, MissingArgCount;
341341
SmallVector<const char *, 256> Argv;
342-
for (auto I = CLArgs.begin(), E = CLArgs.end(); I != E; ++I)
343-
Argv.push_back(I->c_str());
342+
for (const std::string &CLArg : CLArgs)
343+
Argv.push_back(CLArg.c_str());
344344
InputArgList Args = getDriverOptTable().ParseArgs(
345345
Argv, MissingArgIndex, MissingArgCount, VisibilityMask);
346346
std::vector<std::string> Inputs = Args.getAllArgValues(OPT_INPUT);

clang-tools-extra/modularize/ModularizeUtilities.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,7 @@ ModularizeUtilities *ModularizeUtilities::createModularizeUtilities(
6969
// Load all header lists and dependencies.
7070
std::error_code ModularizeUtilities::loadAllHeaderListsAndDependencies() {
7171
// For each input file.
72-
for (auto I = InputFilePaths.begin(), E = InputFilePaths.end(); I != E; ++I) {
73-
llvm::StringRef InputPath = *I;
72+
for (llvm::StringRef InputPath : InputFilePaths) {
7473
// If it's a module map.
7574
if (InputPath.ends_with(".modulemap")) {
7675
// Load the module map.
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
// RUN: clang-reorder-fields -record-name ::bar::Foo -fields-order z,y,x %s -- | FileCheck %s
2+
3+
namespace bar {
4+
5+
#define INT_DECL(NAME) int NAME // CHECK: {{^#define INT_DECL\(NAME\) int NAME}}
6+
#define MACRO_DECL int x; // CHECK-NEXT: {{^#define MACRO_DECL int x;}}
7+
8+
struct Foo {
9+
MACRO_DECL // CHECK: {{^ INT_DECL\(z\);}}
10+
int y; // CHECK-NEXT: {{^ int y;}}
11+
INT_DECL(z); // CHECK-NEXT: {{^ MACRO_DECL}}
12+
};
13+
14+
#define FOO 0 // CHECK: {{^#define FOO 0}}
15+
#define BAR 1 // CHECK-NEXT: {{^#define BAR 1}}
16+
#define BAZ 2 // CHECK-NEXT: {{^#define BAZ 2}}
17+
18+
struct Foo foo = {
19+
FOO, // CHECK: {{^ BAZ,}}
20+
BAR, // CHECK-NEXT: {{^ BAR,}}
21+
BAZ, // CHECK-NEXT: {{^ FOO,}}
22+
};
23+
24+
} // end namespace bar

clang/include/clang/Basic/DiagnosticSemaKinds.td

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1779,7 +1779,7 @@ def note_unsatisfied_trait_reason
17791779
"%HasArcLifetime{has an ARC lifetime qualifier}|"
17801780
"%VLA{is a variably-modified type}|"
17811781
"%VBase{has a virtual base %1}|"
1782-
"%NotScalarOrClass{not %select{a|an array of objects of}1 scalar or "
1782+
"%NotScalarOrClass{is not %select{a|an array of objects of}1 scalar or "
17831783
"class type}|"
17841784
"%NTRBase{has a non-trivially-relocatable base %1}|"
17851785
"%NTRField{has a non-trivially-relocatable member %1 of type %2}|"

clang/lib/AST/ByteCode/Compiler.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6591,10 +6591,6 @@ bool Compiler<Emitter>::visitDeclRef(const ValueDecl *D, const Expr *E) {
65916591
return T->isReferenceType();
65926592
};
65936593

6594-
// DecompositionDecls are just proxies for us.
6595-
if (isa<DecompositionDecl>(VD))
6596-
return revisit(VD);
6597-
65986594
if ((VD->hasGlobalStorage() || VD->isStaticDataMember()) &&
65996595
typeShouldBeVisited(VD->getType())) {
66006596
if (const Expr *Init = VD->getAnyInitializer();

clang/lib/Sema/SemaOverload.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9272,11 +9272,10 @@ class BuiltinOperatorOverloadBuilder {
92729272
/// the candidates into a unique set, then move from that set into the list
92739273
/// of arithmetic types.
92749274
llvm::SmallSetVector<CanQualType, 2> BitIntCandidates;
9275-
llvm::for_each(CandidateTypes, [&BitIntCandidates](
9276-
BuiltinCandidateTypeSet &Candidate) {
9275+
for (BuiltinCandidateTypeSet &Candidate : CandidateTypes) {
92779276
for (QualType BitTy : Candidate.bitint_types())
92789277
BitIntCandidates.insert(CanQualType::CreateUnsafe(BitTy));
9279-
});
9278+
}
92809279
llvm::move(BitIntCandidates, std::back_inserter(ArithmeticTypes));
92819280
LastPromotedIntegralType = ArithmeticTypes.size();
92829281
LastPromotedArithmeticType = ArithmeticTypes.size();

0 commit comments

Comments
 (0)