[llvm-branch-commits] [clang] [llvm] [Coverage][Single] Enable Branch coverage for IfStmt (PR #113111)
NAKAMURA Takumi via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Sat Dec 21 09:13:26 PST 2024
https://github.com/chapuni updated https://github.com/llvm/llvm-project/pull/113111
>From 3ea6383e2142889550f37389dfaaee81e5ae7d9c Mon Sep 17 00:00:00 2001
From: NAKAMURA Takumi <geek4civic at gmail.com>
Date: Sun, 20 Oct 2024 15:15:03 +0900
Subject: [PATCH 1/2] [Coverage][Single] Enable Branch coverage for IfStmt
---
clang/lib/CodeGen/CGStmt.cpp | 31 +++++++---------
clang/lib/CodeGen/CodeGenPGO.cpp | 12 -------
clang/lib/CodeGen/CoverageMappingGen.cpp | 21 +++--------
.../CoverageMapping/single-byte-counters.cpp | 36 ++++++++++---------
4 files changed, 38 insertions(+), 62 deletions(-)
diff --git a/clang/lib/CodeGen/CGStmt.cpp b/clang/lib/CodeGen/CGStmt.cpp
index dbc1ce9bf993cd..c511e5f4f4213a 100644
--- a/clang/lib/CodeGen/CGStmt.cpp
+++ b/clang/lib/CodeGen/CGStmt.cpp
@@ -840,8 +840,7 @@ void CodeGenFunction::EmitIfStmt(const IfStmt &S) {
// If the skipped block has no labels in it, just emit the executed block.
// This avoids emitting dead code and simplifies the CFG substantially.
if (S.isConstexpr() || !ContainsLabel(Skipped)) {
- if (CondConstant)
- incrementProfileCounter(&S);
+ incrementProfileCounter(!CondConstant, &S, true);
if (Executed) {
RunCleanupsScope ExecutedScope(*this);
EmitStmt(Executed);
@@ -851,14 +850,14 @@ void CodeGenFunction::EmitIfStmt(const IfStmt &S) {
}
}
+ auto HasSkip = getIsCounterPair(&S);
+
// Otherwise, the condition did not fold, or we couldn't elide it. Just emit
// the conditional branch.
llvm::BasicBlock *ThenBlock = createBasicBlock("if.then");
llvm::BasicBlock *ContBlock = createBasicBlock("if.end");
- llvm::BasicBlock *ElseBlock = ContBlock;
- if (Else)
- ElseBlock = createBasicBlock("if.else");
-
+ llvm::BasicBlock *ElseBlock =
+ (Else || HasSkip.second ? createBasicBlock("if.else") : ContBlock);
// Prefer the PGO based weights over the likelihood attribute.
// When the build isn't optimized the metadata isn't used, so don't generate
// it.
@@ -891,10 +890,7 @@ void CodeGenFunction::EmitIfStmt(const IfStmt &S) {
// Emit the 'then' code.
EmitBlock(ThenBlock);
- if (llvm::EnableSingleByteCoverage)
- incrementProfileCounter(S.getThen());
- else
- incrementProfileCounter(&S);
+ incrementProfileCounter(false, &S);
{
RunCleanupsScope ThenScope(*this);
EmitStmt(S.getThen());
@@ -908,9 +904,9 @@ void CodeGenFunction::EmitIfStmt(const IfStmt &S) {
auto NL = ApplyDebugLocation::CreateEmpty(*this);
EmitBlock(ElseBlock);
}
- // When single byte coverage mode is enabled, add a counter to else block.
- if (llvm::EnableSingleByteCoverage)
- incrementProfileCounter(Else);
+ // Add a counter to else block unless it has CounterExpr.
+ if (HasSkip.second)
+ incrementProfileCounter(true, &S);
{
RunCleanupsScope ElseScope(*this);
EmitStmt(Else);
@@ -920,15 +916,14 @@ void CodeGenFunction::EmitIfStmt(const IfStmt &S) {
auto NL = ApplyDebugLocation::CreateEmpty(*this);
EmitBranch(ContBlock);
}
+ } else if (HasSkip.second) {
+ EmitBlock(ElseBlock);
+ incrementProfileCounter(true, &S);
+ EmitBranch(ContBlock);
}
// Emit the continuation block for code after the if.
EmitBlock(ContBlock, true);
-
- // When single byte coverage mode is enabled, add a counter to continuation
- // block.
- if (llvm::EnableSingleByteCoverage)
- incrementProfileCounter(&S);
}
bool CodeGenFunction::checkIfLoopMustProgress(const Expr *ControllingExpression,
diff --git a/clang/lib/CodeGen/CodeGenPGO.cpp b/clang/lib/CodeGen/CodeGenPGO.cpp
index 0f2090da47a374..f6b9b5c82952c4 100644
--- a/clang/lib/CodeGen/CodeGenPGO.cpp
+++ b/clang/lib/CodeGen/CodeGenPGO.cpp
@@ -366,18 +366,6 @@ struct MapRegionCounters : public RecursiveASTVisitor<MapRegionCounters> {
if (Hash.getHashVersion() == PGO_HASH_V1)
return Base::TraverseIfStmt(If);
- // When single byte coverage mode is enabled, add a counter to then and
- // else.
- bool NoSingleByteCoverage = !llvm::EnableSingleByteCoverage;
- for (Stmt *CS : If->children()) {
- if (!CS || NoSingleByteCoverage)
- continue;
- if (CS == If->getThen())
- CounterMap[If->getThen()] = NextCounter++;
- else if (CS == If->getElse())
- CounterMap[If->getElse()] = NextCounter++;
- }
-
// Otherwise, keep track of which branch we're in while traversing.
VisitStmt(If);
diff --git a/clang/lib/CodeGen/CoverageMappingGen.cpp b/clang/lib/CodeGen/CoverageMappingGen.cpp
index a331d5bc68286b..6c6aecb9994c6b 100644
--- a/clang/lib/CodeGen/CoverageMappingGen.cpp
+++ b/clang/lib/CodeGen/CoverageMappingGen.cpp
@@ -2050,12 +2050,7 @@ struct CounterCoverageMappingBuilder
extendRegion(S->getCond());
Counter ParentCount = getRegion().getCounter();
- auto [ThenCount, ElseCount] =
- (llvm::EnableSingleByteCoverage
- ? std::make_pair(getRegionCounter(S->getThen()),
- (S->getElse() ? getRegionCounter(S->getElse())
- : Counter::getZero()))
- : getBranchCounterPair(S, ParentCount));
+ auto [ThenCount, ElseCount] = getBranchCounterPair(S, ParentCount);
// Emitting a counter for the condition makes it easier to interpret the
// counter for the body when looking at the coverage.
@@ -2080,26 +2075,20 @@ struct CounterCoverageMappingBuilder
fillGapAreaWithCount(Gap->getBegin(), Gap->getEnd(), ElseCount);
extendRegion(Else);
- Counter ElseOutCount = propagateCounts(ElseCount, Else);
- if (!llvm::EnableSingleByteCoverage)
- OutCount = addCounters(OutCount, ElseOutCount);
+ OutCount = addCounters(OutCount, propagateCounts(ElseCount, Else));
if (ThenHasTerminateStmt)
HasTerminateStmt = true;
- } else if (!llvm::EnableSingleByteCoverage)
+ } else
OutCount = addCounters(OutCount, ElseCount);
- if (llvm::EnableSingleByteCoverage)
- OutCount = getRegionCounter(S);
-
if (!IsCounterEqual(OutCount, ParentCount)) {
pushRegion(OutCount);
GapRegionCounter = OutCount;
}
- if (!llvm::EnableSingleByteCoverage)
- // Create Branch Region around condition.
- createBranchRegion(S->getCond(), ThenCount, ElseCount);
+ // Create Branch Region around condition.
+ createBranchRegion(S->getCond(), ThenCount, ElseCount);
}
void VisitCXXTryStmt(const CXXTryStmt *S) {
diff --git a/clang/test/CoverageMapping/single-byte-counters.cpp b/clang/test/CoverageMapping/single-byte-counters.cpp
index d20b695bc2636a..533f791eee19e0 100644
--- a/clang/test/CoverageMapping/single-byte-counters.cpp
+++ b/clang/test/CoverageMapping/single-byte-counters.cpp
@@ -1,36 +1,39 @@
// RUN: %clang_cc1 -mllvm -emptyline-comment-coverage=false -mllvm -enable-single-byte-coverage=true -fprofile-instrument=clang -fcoverage-mapping -dump-coverage-mapping -emit-llvm-only -main-file-name single-byte-counters.cpp %s | FileCheck %s
// CHECK: testIf
-int testIf(int x) { // CHECK-NEXT: File 0, [[@LINE]]:19 -> [[@LINE+7]]:2 = [[C00:#0]]
+int testIf(int x) { // CHECK-NEXT: File 0, [[@LINE]]:19 -> [[@LINE+8]]:2 = [[C00:#0]]
int result = 0;
if (x == 0) // CHECK-NEXT: File 0, [[@LINE]]:7 -> [[@LINE]]:13 = [[C00]]
- // CHECK-NEXT: Gap,File 0, [[@LINE-1]]:14 -> [[@LINE+1]]:5 = [[C0T:#1]]
+ // CHECK-NEXT: Branch,File 0, [[@LINE-1]]:7 -> [[@LINE-1]]:13 = [[C0T:#1]], [[C0F:#2]]
+ // CHECK-NEXT: Gap,File 0, [[@LINE-2]]:14 -> [[@LINE+1]]:5 = [[C0T]]
result = -1; // CHECK-NEXT: File 0, [[@LINE]]:5 -> [[@LINE]]:16 = [[C0T]]
- return result; // CHECK-NEXT: File 0, [[@LINE]]:3 -> [[@LINE]]:16 = [[C0E:#2]]
+ return result; // #0
}
// CHECK-NEXT: testIfElse
-int testIfElse(int x) { // CHECK-NEXT: File 0, [[@LINE]]:23 -> [[@LINE+8]]:2 = [[C10:#0]]
+int testIfElse(int x) { // CHECK-NEXT: File 0, [[@LINE]]:23 -> [[@LINE+9]]:2 = [[C10:#0]]
int result = 0;
if (x < 0) // CHECK-NEXT: File 0, [[@LINE]]:7 -> [[@LINE]]:12 = [[C10]]
- // CHECK-NEXT: Gap,File 0, [[@LINE-1]]:13 -> [[@LINE+1]]:5 = [[C1T:#1]]
+ // CHECK-NEXT: Branch,File 0, [[@LINE-1]]:7 -> [[@LINE-1]]:12 = [[C1T:#1]], [[C1F:#2]]
+ // CHECK-NEXT: Gap,File 0, [[@LINE-2]]:13 -> [[@LINE+1]]:5 = [[C1T]]
result = 0; // CHECK-NEXT: File 0, [[@LINE]]:5 -> [[@LINE]]:15 = [[C1T]]
- else // CHECK-NEXT: Gap,File 0, [[@LINE-1]]:16 -> [[@LINE+1]]:5 = [[C1F:#2]]
+ else // CHECK-NEXT: Gap,File 0, [[@LINE-1]]:16 -> [[@LINE+1]]:5 = [[C1F]]
result = x * x; // CHECK-NEXT: File 0, [[@LINE]]:5 -> [[@LINE]]:19 = [[C1F]]
- return result; // CHECK-NEXT: File 0, [[@LINE]]:3 -> [[@LINE]]:16 = [[C1E:#3]]
+ return result; // #0
}
// CHECK-NEXT: testIfElseReturn
-int testIfElseReturn(int x) { // CHECK-NEXT: File 0, [[@LINE]]:29 -> [[@LINE+9]]:2 = [[C20:#0]]
+int testIfElseReturn(int x) { // CHECK-NEXT: File 0, [[@LINE]]:29 -> [[@LINE+10]]:2 = [[C20:#0]]
int result = 0;
if (x > 0) // CHECK-NEXT: File 0, [[@LINE]]:7 -> [[@LINE]]:12 = [[C20]]
- // CHECK-NEXT: Gap,File 0, [[@LINE-1]]:13 -> [[@LINE+1]]:5 = [[C2T:#1]]
+ // CHECK-NEXT: Branch,File 0, [[@LINE-1]]:7 -> [[@LINE-1]]:12 = [[C2T:#1]], [[C2F:#2]]
+ // CHECK-NEXT: Gap,File 0, [[@LINE-2]]:13 -> [[@LINE+1]]:5 = [[C2T]]
result = x * x; // CHECK-NEXT: File 0, [[@LINE]]:5 -> [[@LINE]]:19 = [[C2T]]
- else // CHECK-NEXT: Gap,File 0, [[@LINE-1]]:20 -> [[@LINE+1]]:5 = [[C2F:#2]]
+ else // CHECK-NEXT: Gap,File 0, [[@LINE-1]]:20 -> [[@LINE+1]]:5 = [[C2F]]
return 0; // CHECK-NEXT: File 0, [[@LINE]]:5 -> [[@LINE]]:13 = [[C2F]]
- // CHECK-NEXT: Gap,File 0, [[@LINE-1]]:14 -> [[@LINE+1]]:3 = [[C2E:#3]]
- return result; // CHECK-NEXT: File 0, [[@LINE]]:3 -> [[@LINE]]:16 = [[C2E:#3]]
+ // CHECK-NEXT: Gap,File 0, [[@LINE-1]]:14 -> [[@LINE+1]]:3 = [[C2T]]
+ return result; // CHECK-NEXT: File 0, [[@LINE]]:3 -> [[@LINE]]:16 = [[C2T]]
}
// CHECK-NEXT: testSwitch
@@ -68,16 +71,17 @@ int testWhile() { // CHECK-NEXT: File 0, [[@LINE]]:17 -> [[@LINE+11]]:2 =
}
// CHECK-NEXT: testContinue
-int testContinue() { // CHECK-NEXT: File 0, [[@LINE]]:20 -> [[@LINE+15]]:2 = [[C50:#0]]
+int testContinue() { // CHECK-NEXT: File 0, [[@LINE]]:20 -> [[@LINE+16]]:2 = [[C50:#0]]
int i = 0;
int sum = 0;
while (i < 10) { // CHECK-NEXT: File 0, [[@LINE]]:10 -> [[@LINE]]:16 = [[C5C:#1]]
// CHECK-NEXT: Gap,File 0, [[@LINE-1]]:17 -> [[@LINE-1]]:18 = [[C5B:#2]]
- // CHECK-NEXT: File 0, [[@LINE-2]]:18 -> [[@LINE+7]]:4 = [[C5B]]
+ // CHECK-NEXT: File 0, [[@LINE-2]]:18 -> [[@LINE+8]]:4 = [[C5B]]
if (i == 4) // CHECK-NEXT: File 0, [[@LINE]]:9 -> [[@LINE]]:15 = [[C5B]]
- // CHECK-NEXT: Gap,File 0, [[@LINE-1]]:16 -> [[@LINE+1]]:7 = [[C5T:#4]]
+ // CHECK-NEXT: Branch,File 0, [[@LINE-1]]:9 -> [[@LINE-1]]:15 = [[C5T:#4]], [[C5F:#5]]
+ // CHECK-NEXT: Gap,File 0, [[@LINE-2]]:16 -> [[@LINE+1]]:7 = [[C5T]]
continue; // CHECK-NEXT: File 0, [[@LINE]]:7 -> [[@LINE]]:15 = [[C5T]]
- // CHECK-NEXT: Gap,File 0, [[@LINE-1]]:16 -> [[@LINE+1]]:5 = [[C5F:#5]]
+ // CHECK-NEXT: Gap,File 0, [[@LINE-1]]:16 -> [[@LINE+1]]:5 = [[C5F]]
sum += i; // CHECK-NEXT: File 0, [[@LINE]]:5 -> [[@LINE+2]]:4 = [[C5F]]
i++;
}
>From b2f7fdf6e1e80c191fde07f40de50fe26c4c6eff Mon Sep 17 00:00:00 2001
From: NAKAMURA Takumi <geek4civic at gmail.com>
Date: Thu, 21 Nov 2024 00:08:44 +0900
Subject: [PATCH 2/2] Update single tests
---
.../Inputs/branch-c-general-single.proftext | 41 ++++++------
.../Inputs/branch-c-general-single.yaml | 24 +++----
.../tools/llvm-cov/Inputs/branch-c-general.c | 62 +++++++++----------
.../branch-logical-mixed-single.proftext | 8 +--
.../Inputs/branch-logical-mixed-single.yaml | 4 +-
.../llvm-cov/Inputs/branch-logical-mixed.cpp | 8 +--
.../Inputs/branch-templates-single.proftext | 13 ++--
.../Inputs/branch-templates-single.yaml | 16 ++---
.../llvm-cov/Inputs/branch-templates.cpp | 18 +++---
.../showLineExecutionCounts-single.proftext | 5 +-
.../showLineExecutionCounts-single.yaml | 4 +-
.../test/tools/llvm-cov/branch-templates.test | 2 +
12 files changed, 98 insertions(+), 107 deletions(-)
diff --git a/llvm/test/tools/llvm-cov/Inputs/branch-c-general-single.proftext b/llvm/test/tools/llvm-cov/Inputs/branch-c-general-single.proftext
index ea8c6f9bc634ed..eae18299e95d7f 100644
--- a/llvm/test/tools/llvm-cov/Inputs/branch-c-general-single.proftext
+++ b/llvm/test/tools/llvm-cov/Inputs/branch-c-general-single.proftext
@@ -28,11 +28,11 @@ big_switch
1
1
1
-1
-1
-1
-1
-1
+0
+0
+0
+0
+0
boolean_operators
# Func Hash:
@@ -116,7 +116,7 @@ conditionals
# Func Hash:
4904767535850050386
# Num Counters:
-25
+23
# Counter Values:
1
1
@@ -124,10 +124,6 @@ conditionals
1
1
1
-0
-1
-1
-1
1
1
1
@@ -139,7 +135,9 @@ conditionals
1
1
1
+0
1
+0
1
1
1
@@ -165,7 +163,7 @@ early_exits
# Func Hash:
2880354649761471549
# Num Counters:
-20
+19
# Counter Values:
1
0
@@ -177,15 +175,14 @@ early_exits
1
1
1
-1
-1
-1
+0
1
0
1
1
1
0
+1
0
jumps
@@ -200,11 +197,9 @@ jumps
1
0
0
-0
1
0
1
-1
0
1
1
@@ -214,8 +209,6 @@ jumps
1
1
1
-1
-1
0
1
1
@@ -228,10 +221,14 @@ jumps
1
1
0
+1
+1
0
1
1
1
+0
+1
main
# Func Hash:
@@ -281,17 +278,17 @@ switches
1
1
1
-1
-1
-1
-1
0
1
1
1
1
+0
1
1
0
0
+0
+1
+0
diff --git a/llvm/test/tools/llvm-cov/Inputs/branch-c-general-single.yaml b/llvm/test/tools/llvm-cov/Inputs/branch-c-general-single.yaml
index 9d23dcb67ad2ac..fd1fa6302f6fb4 100644
--- a/llvm/test/tools/llvm-cov/Inputs/branch-c-general-single.yaml
+++ b/llvm/test/tools/llvm-cov/Inputs/branch-c-general-single.yaml
@@ -16,27 +16,27 @@ Sections:
Type: SHT_PROGBITS
Flags: [ SHF_GNU_RETAIN ]
AddressAlign: 0x8
- Content: 83AD05A5F1438E68EA00000052D33558163C11444C551E9517F40F4F010100260111150E02050113001A09001C001F0D002000A1808080080D00210B040D0109000E15000F009080808008150010020615010B000C21000D008E8080800821000E0010310106008C8080800831000C04063100100015290016009780808008290017020629010B000C35000D008E8080800835000E00102D0106008C808080082D000C02062D010B000C3D000D008E808080083D000E0010100201005B1D010502041D0009000A1D0009000F4D000E000F45001000918080800845001100134901050104490009000A490009000F5D000E000F55001000918080800855001100131002010001
+ Content: 83AD05A5F1438E680301000052D33558163C11444C551E9517F40F4F010100290111150E02050113001A09001C001F0D002000A1808080080D00210B040D0109000E2015410009000E15000F009080808008150010020615010B000C201945000B000C19000D008E8080800819000E0010410106008C8080800841000C04064100100015201D49001000151D00160097808080081D001702061D010B000C20214D000B000C21000D008E8080800821000E0010490106008C8080800849000C020649010B000C202551000B000C25000D008E8080800825000E0010100201005B0D0109000A0D0009000F2D000E000F29001000918080800829001100130D0109000A0D0009000F39000E000F35001000918080800835001100131002010001
- Name: '__llvm_covfun (2)'
Type: SHT_PROGBITS
Flags: [ SHF_GNU_RETAIN ]
AddressAlign: 0x8
- Content: 0449C70428C57369F80000003D5C2D0E4B13F9274C551E9517F40F4F01010028012114180210020100010101070008050009008A8080800805000A000C100101000109010313020D000A00111100120093808080081100130604110209000F190010018780808008190107000C1D000D0185808080081D010502041D0009000E21000F018780808008210107000F15010402838080800810010100011501030B021500070008290009008A8080800829000A000C10010100012D010309023100060504310109000F3D00100187808080083D0107000D41000E028780808008410207000A35010C0013390015028380808008100101000139010302023900070008490009008A8080800849000A000C1001010001
+ Content: 0449C70428C57369180100003D5C2D0E4B13F9274C551E9517F40F4F0101002C01211418021002010001010107000820053500070008050009008A8080800805000A000C100101000109010A00110D00120093808080080D001306040D0209000F2015390009000F150010018780808008150107000C39000D0185808080083901050204390009000E20193D0009000E19000F018780808008190107000F11010402838080800810010100011101030B021100070008201D41000700081D0009008A808080081D000A000C10010100012101060504210109000F202D450009000F2D00100187808080082D0107000D45000E028780808008450207000A25010C001329001502838080800810010100012901030202290007000820314900070008310009008A8080800831000A000C1001010001
- Name: '__llvm_covfun (3)'
Type: SHT_PROGBITS
Flags: [ SHF_GNU_RETAIN ]
AddressAlign: 0x8
- Content: 55947829059F255EB80100001B9C495D3463E1D04C551E9517F40F4F01010046013B0E2F02100201000105010F001409001600190D001A009B808080080D001B040400011402858080800810010100230001050104000009000A15000B008C8080800815000C000E11010402818080800810010100011D010126021D01070008210009008A8080800821000A000C1001010001250103000D25000E0283808080081001010001000103210229000A000B2D000C008D808080082D000D03043501030204350109000A39000B008C8080800839000C000E1002010001310103000D31000E0181808080084101011B024501011A024901011902490207000C4D000D0185808080084D0105000F5100100283808080081001010001510103140255000A000F5900100091808080085900110A04610103090400011006918080800869010501110001120185808080086D0105011200011301858080800871010501115D030402838080800810010100015D0103080275000F0015790017001A7D001B009C808080087D001C0604000115028580808008100101003F0001050304000009000A8501000B008C808080088501000C000E8D01010302048D010109000A9101000B008C808080089101000C000E1002010001
+ Content: 55947829059F255EDF0100001B9C495D3463E1D04C551E9517F40F4F0101004B013B0E2F02100201000105010F001409001600190D001A009B808080080D001B040400011402858080800810010100230001050104000009000A201581010009000A15000B008C8080800815000C000E1101040281808080081001010001190101030D1901070008201D8501000700081D0009008A808080081D000A000C100101000100010E0283808080081001010001000103210221000A000B25000C008D8080800825000D03042D010302042D0109000A203189010009000A31000B008C8080800831000C000E1002010001290103000D29000E0181808080083501011B023901011A023D010119023D0207000C20418D010007000C41000D018580808008410105000F8D01001002838080800810010100018D010103140245000A000F4900100091808080084900110A04510103090400011006918080800859010501110001120185808080085D0105011200011301858080800861010501114D030402838080800810010100014D0103080265000F0015690017001A6D001B009C808080086D001C0604000115028580808008100101003F0001050304000009000A207591010009000A75000B008C8080800875000C000E7901030204790109000A207D95010009000A7D000B008C808080087D000C000E1002010001
- Name: '__llvm_covfun (4)'
Type: SHT_PROGBITS
Flags: [ SHF_GNU_RETAIN ]
AddressAlign: 0x8
- Content: 7129CA3C268292BF4D0100003E688383C9A099004C551E9517F40F4F01010035016C112502100201011C000217028A80808008090103010A05020402838080800810010100620501031C020D003F0046110048004B15004C00CD8080800815004D1704000119148F80808008210105130F21010B000C25000D008E8080800825000E001010010100152D0105100F2D010B000C31000D008E8080800831000E0010350107000C35000D0185808080083901050D0F39010B000C3D000D008E808080083D000E0010410107000F4100100185808080084501050A0F45010B000C49000D008E8080800849000E00104D0107080F000012039180808008550107021155010D000E59000F00908080800859001000125D010900115101080285808080081001010001610105020F61010B0017650018018980808008650109000F1902040383808080081001010121190203020219000700116D00120093808080086D001300151001010001
+ Content: 7129CA3C268292BF6A0100003E688383C9A099004C551E9517F40F4F01010038016C112502100201011C000217028A80808008090103010A05020402838080800810010100620501031C020D003F0046110048004B15004C00CD8080800815004D1704000119148F80808008210105130F21010B000C202559000B000C25000D008E8080800825000E00101001010015290105020C29010B000C202D5D000B000C2D000D008E808080082D000E001000010D018580808008310105020F31010B000C203561000B000C35000D008E8080800835000E00100001100185808080083901050A0F39010B000C203D65000B000C3D000D008E808080083D000E0010000112039180808008450107021145010D000E204969000D000E49000F009080808008490010001241020802858080800810010100014D0105020F4D010B001720516D000B0017510018018980808008510109000F1902040383808080081001010121190203020219000700112055710007001155001200938080800855001300151001010001
- Name: '__llvm_covfun (5)'
Type: SHT_PROGBITS
Flags: [ SHF_GNU_RETAIN ]
AddressAlign: 0x8
- Content: 3F4D1C6E6087417B32010000D6FF56B8865A69B64C551E9517F40F4F01010031019301131F02050113001909001B001E0D001F00A0808080080D00201C04000115198C80808008190105180C19010B000C1D000D008E808080081D000E00101001010015250105150C25010B000C29000D008E8080800829000E00102D0107000C2D000D018580808008310105120C31010B000C35000D008E8080800835000E0010390107000C39000D03858080800810010101013D02050D0C3D010B000C41000D008E8080800841000E0010450107000C45000D0185808080084901050A0C49010B000C4D000D008E808080084D000E0010510107000C51000D0385808080081001010101550205050C55010B000C59000D008E8080800859000E00105D0107000C5D000D018580808008610105020C61010B000C65000D008E8080800865000E0010690107000C1003010001
+ Content: 3F4D1C6E6087417B45010000D6FF56B8865A69B64C551E9517F40F4F01010032019301131F02050113001909001B001E0D001F00A0808080080D00201C04000115198C80808008190105180C19010B000C201D51000B000C1D000D008E808080081D000E00101001010015210105020C21010B000C202555000B000C25000D008E8080800825000E001000010D018580808008290105020C29010B000C202D59000B000C2D000D008E808080082D000E001000010D0385808080081001010101310205020C31010B000C20355D000B000C35000D008E8080800835000E001000010D018580808008390105020C39010B000C203D61000B000C3D000D008E808080083D000E001000010D0385808080081001010101410205020C41010B000C204565000B000C45000D008E8080800845000E001000010D018580808008490105020C49010B000C204D69000B000C4D000D008E808080084D000E00101004010001
- Name: '__llvm_covfun (6)'
Type: SHT_PROGBITS
Flags: [ SHF_GNU_RETAIN ]
@@ -56,7 +56,7 @@ Sections:
Type: SHT_PROGBITS
Flags: [ SHF_GNU_RETAIN ]
AddressAlign: 0x8
- Content: 7DE8E7C47096EB425200000092EAF0986287F0784C551E9517F40F4F0101000D01DA01170B02050113001909001B001E0D001F00A0808080080D002009041502080606100101024D15030B00102100110092808080082100120017250018018780808008250107010619010E0013
+ Content: 7DE8E7C47096EB425900000092EAF0986287F0784C551E9517F40F4F0101000E01DA01170B02050113001909001B001E0D001F00A0808080080D002009041502080606100101024D15030B0010202125000B00102100110092808080082100120017250018018780808008250107010619010E0013
- Name: '__llvm_covfun (10)'
Type: SHT_PROGBITS
Flags: [ SHF_GNU_RETAIN ]
@@ -112,31 +112,31 @@ Symbols:
Type: STT_OBJECT
Section: '__llvm_covfun (1)'
Binding: STB_WEAK
- Size: 0x106
+ Size: 0x11F
Other: [ STV_HIDDEN ]
- Name: __covrec_6973C52804C74904u
Type: STT_OBJECT
Section: '__llvm_covfun (2)'
Binding: STB_WEAK
- Size: 0x114
+ Size: 0x134
Other: [ STV_HIDDEN ]
- Name: __covrec_5E259F0529789455u
Type: STT_OBJECT
Section: '__llvm_covfun (3)'
Binding: STB_WEAK
- Size: 0x1D4
+ Size: 0x1FB
Other: [ STV_HIDDEN ]
- Name: __covrec_BF9282263CCA2971u
Type: STT_OBJECT
Section: '__llvm_covfun (4)'
Binding: STB_WEAK
- Size: 0x169
+ Size: 0x186
Other: [ STV_HIDDEN ]
- Name: __covrec_7B4187606E1C4D3Fu
Type: STT_OBJECT
Section: '__llvm_covfun (5)'
Binding: STB_WEAK
- Size: 0x14E
+ Size: 0x161
Other: [ STV_HIDDEN ]
- Name: __covrec_58A39A89A88AA459u
Type: STT_OBJECT
@@ -160,7 +160,7 @@ Symbols:
Type: STT_OBJECT
Section: '__llvm_covfun (9)'
Binding: STB_WEAK
- Size: 0x6E
+ Size: 0x75
Other: [ STV_HIDDEN ]
- Name: __covrec_DB956436E78DD5FAu
Type: STT_OBJECT
diff --git a/llvm/test/tools/llvm-cov/Inputs/branch-c-general.c b/llvm/test/tools/llvm-cov/Inputs/branch-c-general.c
index 5ea9ecb42b0ed1..d8d4dad5b0ed15 100644
--- a/llvm/test/tools/llvm-cov/Inputs/branch-c-general.c
+++ b/llvm/test/tools/llvm-cov/Inputs/branch-c-general.c
@@ -16,12 +16,12 @@ void simple_loops() { // CHECK: @LINE|{{.*}}simple_loops()
void conditionals() { // CHECK: @LINE|{{.*}}conditionals()
for (int i = 0; i < 100; ++i) {//BRCOV: Branch ([[@LINE]]:19): [True: [[C100]], False: 1]
- if (i % 2) { // BRCOV: Branch ([[@LINE]]:9): [True: [[C50:50|1]], False: [[C50]]]
- if (i) {} // BRCOV: Branch ([[@LINE]]:11): [True: [[C50]], False: 0]
- } else if (i % 3) { // BRCOV: Branch ([[@LINE]]:16): [True: [[C33:33|1]], False: [[C17:17|1]]]
- if (i) {} // BRCOV: Branch ([[@LINE]]:11): [True: [[C33]], False: 0]
+ if (i % 2) { // CHECK: Branch ([[@LINE]]:9): [True: [[C50:50|1]], False: [[C50]]]
+ if (i) {} // CHECK: Branch ([[@LINE]]:11): [True: [[C50]], False: 0]
+ } else if (i % 3) { // CHECK: Branch ([[@LINE]]:16): [True: [[C33:33|1]], False: [[C17:17|1]]]
+ if (i) {} // CHECK: Branch ([[@LINE]]:11): [True: [[C33]], False: 0]
} else {
- if (i) {} // BRCOV: Branch ([[@LINE]]:11): [True: [[C16:16|1]], False: 1]
+ if (i) {} // CHECK: Branch ([[@LINE]]:11): [True: [[C16:16|1]], False: 1]
}
// BRCOV: Branch ([[@LINE+1]]:9): [True: [[C100]], Folded]
if (1 && i) {} // BRCOV: Branch ([[@LINE]]:14): [True: [[C99:99|1]], False: 1]
@@ -33,26 +33,26 @@ void conditionals() { // CHECK: @LINE|{{.*}}conditionals()
void early_exits() { // CHECK: @LINE|{{.*}}early_exits()
int i = 0;
- if (i) {} // BRCOV: Branch ([[@LINE]]:7): [True: 0, False: 1]
+ if (i) {} // CHECK: Branch ([[@LINE]]:7): [True: 0, False: 1]
while (i < 100) { // BRCOV: Branch ([[@LINE]]:10): [True: [[C51:51|1]], False: 0]
i++;
- if (i > 50) // BRCOV: Branch ([[@LINE]]:9): [True: 1, False: [[C50]]]
+ if (i > 50) // CHECK: Branch ([[@LINE]]:9): [True: 1, False: [[C50]]]
break;
- if (i % 2) // BRCOV: Branch ([[@LINE]]:9): [True: [[C25:25|1]], False: [[C25]]]
+ if (i % 2) // CHECK: Branch ([[@LINE]]:9): [True: [[C25:25|1]], False: [[C25]]]
continue;
}
- if (i) {} // BRCOV: Branch ([[@LINE]]:7): [True: 1, False: 0]
+ if (i) {} // CHECK: Branch ([[@LINE]]:7): [True: 1, False: 0]
do {
- if (i > 75) // BRCOV: Branch ([[@LINE]]:9): [True: 1, False: [[C25]]]
+ if (i > 75) // CHECK: Branch ([[@LINE]]:9): [True: 1, False: [[C25]]]
return;
else
i++;
} while (i < 100); // BRCOV: Branch ([[@LINE]]:12): [True: [[C25]], False: 0]
- if (i) {} // BRCOV: Branch ([[@LINE]]:7): [True: 0, False: 0]
+ if (i) {} // CHECK: Branch ([[@LINE]]:7): [True: 0, False: 0]
}
@@ -62,17 +62,17 @@ void jumps() { // CHECK: @LINE|{{.*}}jumps()
for (i = 0; i < 2; ++i) { // BRCOV: Branch ([[@LINE]]:15): [True: 1, False: 0]
goto outofloop;
// Never reached -> no weights
- if (i) {} // BRCOV: Branch ([[@LINE]]:9): [True: 0, False: 0]
+ if (i) {} // CHECK: Branch ([[@LINE]]:9): [True: 0, False: 0]
}
outofloop:
- if (i) {} // BRCOV: Branch ([[@LINE]]:7): [True: 0, False: 1]
+ if (i) {} // CHECK: Branch ([[@LINE]]:7): [True: 0, False: 1]
goto loop1;
while (i) { // BRCOV: Branch ([[@LINE]]:10): [True: 0, False: 1]
loop1:
- if (i) {} // BRCOV: Branch ([[@LINE]]:9): [True: 0, False: 1]
+ if (i) {} // CHECK: Branch ([[@LINE]]:9): [True: 0, False: 1]
}
goto loop2;
@@ -80,7 +80,7 @@ void jumps() { // CHECK: @LINE|{{.*}}jumps()
second:
third:
i++;
- if (i < 3) // BRCOV: Branch ([[@LINE]]:7): [True: [[C2:2|1]], False: 1]
+ if (i < 3) // CHECK: Branch ([[@LINE]]:7): [True: [[C2:2|1]], False: 1]
goto loop2;
while (i < 3) { // BRCOV: Branch ([[@LINE]]:10): [True: 0, False: 1]
@@ -98,9 +98,9 @@ void jumps() { // CHECK: @LINE|{{.*}}jumps()
for (i = 0; i < 10; ++i) { // BRCOV: Branch ([[@LINE]]:15): [True: [[C10:10|1]], False: 1]
goto withinloop;
// never reached -> no weights
- if (i) {} // BRCOV: Branch ([[@LINE]]:9): [True: 0, False: 0]
+ if (i) {} // CHECK: Branch ([[@LINE]]:9): [True: 0, False: 0]
withinloop:
- if (i) {} // BRCOV: Branch ([[@LINE]]:9): [True: [[C9:9|1]], False: 1]
+ if (i) {} // CHECK: Branch ([[@LINE]]:9): [True: [[C9:9|1]], False: 1]
}
}
@@ -117,30 +117,30 @@ void switches() { // CHECK: @LINE|{{.*}}switches()
for (int i = 0, len = sizeof(weights) / sizeof(weights[0]); i < len; ++i) {
switch (i[weights]) {
case 1: // BRCOV: Branch ([[@LINE]]:5): [True: 1, Folded]
- if (i) {} // BRCOV: Branch ([[@LINE]]:11): [True: 0, False: 1]
+ if (i) {} // CHECK: Branch ([[@LINE]]:11): [True: 0, False: 1]
// fallthrough
case 2: // BRCOV: Branch ([[@LINE]]:5): [True: [[C2]], Folded]
- if (i) {} // BRCOV: Branch ([[@LINE]]:11): [True: [[C2]], False: 1]
+ if (i) {} // CHECK: Branch ([[@LINE]]:11): [True: [[C2]], False: 1]
break;
case 3: // BRCOV: Branch ([[@LINE]]:5): [True: [[C3:3|1]], Folded]
- if (i) {} // BRCOV: Branch ([[@LINE]]:11): [True: [[C3]], False: 0]
+ if (i) {} // CHECK: Branch ([[@LINE]]:11): [True: [[C3:3|1]], False: 0]
continue;
case 4: // BRCOV: Branch ([[@LINE]]:5): [True: [[C4:4|1]], Folded]
- if (i) {} // BRCOV: Branch ([[@LINE]]:11): [True: [[C4]], False: 0]
+ if (i) {} // CHECK: Branch ([[@LINE]]:11): [True: [[C4:4|1]], False: 0]
switch (i) {
case 6 ... 9: // BRCOV: Branch ([[@LINE]]:7): [True: [[C4]], Folded]
- if (i) {} // BRCOV: Branch ([[@LINE]]:13): [True: [[C4]], False: 0]
+ if (i) {} // CHECK: Branch ([[@LINE]]:13): [True: [[C4]], False: 0]
continue;
}
default: // BRCOV: Branch ([[@LINE]]:5): [True: [[C5:5|1]], Folded]
- if (i == len - 1) // BRCOV: Branch ([[@LINE]]:11): [True: 1, False: [[C4]]]
+ if (i == len - 1) // CHECK: Branch ([[@LINE]]:11): [True: 1, False: [[C4]]]
return;
}
}
// Never reached -> no weights
- if (weights[0]) {} // BRCOV: Branch ([[@LINE]]:7): [True: 0, False: 0]
+ if (weights[0]) {} // CHECK: Branch ([[@LINE]]:7): [True: 0, False: 0]
}
@@ -148,29 +148,29 @@ void big_switch() { // CHECK: @LINE|{{.*}}big_switch()
for (int i = 0; i < 32; ++i) {// BRCOV: Branch ([[@LINE]]:19): [True: [[C32:32|1]], False: 1]
switch (1 << i) {
case (1 << 0): // BRCOV: Branch ([[@LINE]]:5): [True: 1, Folded]
- if (i) {} // BRCOV: Branch ([[@LINE]]:11): [True: 0, False: 1]
+ if (i) {} // CHECK: Branch ([[@LINE]]:11): [True: 0, False: 1]
// fallthrough
case (1 << 1): // BRCOV: Branch ([[@LINE]]:5): [True: 1, Folded]
- if (i) {} // BRCOV: Branch ([[@LINE]]:11): [True: 1, False: 1]
+ if (i) {} // CHECK: Branch ([[@LINE]]:11): [True: 1, False: 1]
break;
case (1 << 2) ... (1 << 12):// BRCOV: Branch ([[@LINE]]:5): [True: [[C11:11|1]], Folded]
- if (i) {} // BRCOV: Branch ([[@LINE]]:11): [True: [[C11]], False: 0]
+ if (i) {} // CHECK: Branch ([[@LINE]]:11): [True: [[C11:11|1]], False: 0]
break;
// The branch for the large case range above appears after the case body.
case (1 << 13): // BRCOV: Branch ([[@LINE]]:5): [True: 1, Folded]
- if (i) {} // BRCOV: Branch ([[@LINE]]:11): [True: 1, False: 0]
+ if (i) {} // CHECK: Branch ([[@LINE]]:11): [True: 1, False: 0]
break;
case (1 << 14) ... (1 << 28)://BRCOV: Branch ([[@LINE]]:5): [True: [[C15]], Folded]
- if (i) {} // BRCOV: Branch ([[@LINE]]:11): [True: [[C15]], False: 0]
+ if (i) {} // CHECK: Branch ([[@LINE]]:11): [True: [[C15:15|1]], False: 0]
break;
// The branch for the large case range above appears after the case body.
case (1 << 29) ... ((1 << 29) + 1):
- if (i) {} // BRCOV: Branch ([[@LINE]]:11): [True: 1, False: 0]
+ if (i) {} // CHECK: Branch ([[@LINE]]:11): [True: 1, False: 0]
break;
default: // BRCOV: Branch ([[@LINE]]:5): [True: [[C2]], Folded]
- if (i) {} // BRCOV: Branch ([[@LINE]]:11): [True: [[C2]], False: 0]
+ if (i) {} // CHECK: Branch ([[@LINE]]:11): [True: [[C2]], False: 0]
break;
}
}
diff --git a/llvm/test/tools/llvm-cov/Inputs/branch-logical-mixed-single.proftext b/llvm/test/tools/llvm-cov/Inputs/branch-logical-mixed-single.proftext
index f9662438de0e64..798e150d80a1ae 100644
--- a/llvm/test/tools/llvm-cov/Inputs/branch-logical-mixed-single.proftext
+++ b/llvm/test/tools/llvm-cov/Inputs/branch-logical-mixed-single.proftext
@@ -4,7 +4,7 @@ _Z4funcii
# Func Hash:
8468630735863722633
# Num Counters:
-67
+63
# Counter Values:
4
0
@@ -63,16 +63,12 @@ _Z4funcii
0
0
4
-4
-4
-0
-4
1
3
4
+0
3
1
-4
main
# Func Hash:
diff --git a/llvm/test/tools/llvm-cov/Inputs/branch-logical-mixed-single.yaml b/llvm/test/tools/llvm-cov/Inputs/branch-logical-mixed-single.yaml
index 56f3d4955f4d93..0c36f48789a510 100644
--- a/llvm/test/tools/llvm-cov/Inputs/branch-logical-mixed-single.yaml
+++ b/llvm/test/tools/llvm-cov/Inputs/branch-logical-mixed-single.yaml
@@ -11,7 +11,7 @@ Sections:
Type: SHT_PROGBITS
Flags: [ SHF_GNU_RETAIN ]
AddressAlign: 0x8
- Content: F0A0ED2C305C0BB32D02000089B21C19C99E86758F2950E06FBD46E8010100600108194302100701000101010C000E01000C010E01000C020E01000C030E01000C040E25010C000E1D010C000E15010C000E0D010C000E05010C000E100101000101010C000E01000C010E01000C020E01000C030E01000C040E4D010C000E45010C000E3D010C000E35010C000E2D010C000E100101000101010C011001000C031001000C051001000C071001000C091001000D000F69010D000F65010C011065000D000F71010D000F61010C011061000D000F79010D000F5D010C01105D000D000F8101010D000F59010C011059000D000F8901010D000F55010C011055000D000F9101010D000F100101000101010C011001000C031001000C051001000C071001000C091001000D000FAD01010D000FA901010C0110A901000D000FB501010D000FA501010C0110A501000D000FBD01010D000FA101010C0110A101000D000FC501010D000F9D01010C01109D01000D000FCD01010D000F9901010C01109901000D000FD501010D000F10010100010101070008DD010009018580808008DD0101050016E1010017028580808008E101020500161001010001E50101030E02E50100070008E9010009018580808008E90101050016ED010017028580808008ED01020500161001010001F10101030902F10100070008F5010009018580808008F50101050016F9010017028580808008F901020500161001010001FD0101030402FD01000700088102000901858080800881020105001685020017028580808008850202050016
+ Content: F0A0ED2C305C0BB33C02000089B21C19C99E86758F2950E06FBD46E8010100610108194302100701000101010C000E01000C010E01000C020E01000C030E01000C040E25010C000E1D010C000E15010C000E0D010C000E05010C000E100101000101010C000E01000C010E01000C020E01000C030E01000C040E4D010C000E45010C000E3D010C000E35010C000E2D010C000E100101000101010C011001000C031001000C051001000C071001000C091001000D000F69010D000F65010C011065000D000F71010D000F61010C011061000D000F79010D000F5D010C01105D000D000F8101010D000F59010C011059000D000F8901010D000F55010C011055000D000F9101010D000F100101000101010C011001000C031001000C051001000C071001000C091001000D000FAD01010D000FA901010C0110A901000D000FB501010D000FA501010C0110A501000D000FBD01010D000FA101010C0110A101000D000FC501010D000F9D01010C01109D01000D000FCD01010D000F9901010C01109901000D000FD501010D000F1001010001010107000820DD01ED0100070008DD010009018580808008DD0101050016ED010017028580808008ED01020500161001010001010107000820E101F10100070008E1010009018580808008E10101050016F1010017028580808008F101020500161001010001010107000820E501F50100070008E5010009018580808008E50101050016F5010017028580808008F501020500161001010001010107000820E901F90100070008E9010009018580808008E90101050016F9010017028580808008F90102050016
- Name: '__llvm_covfun (1)'
Type: SHT_PROGBITS
Flags: [ SHF_GNU_RETAIN ]
@@ -46,7 +46,7 @@ Symbols:
Type: STT_OBJECT
Section: __llvm_covfun
Binding: STB_WEAK
- Size: 0x249
+ Size: 0x258
Other: [ STV_HIDDEN ]
- Name: __covrec_DB956436E78DD5FAu
Type: STT_OBJECT
diff --git a/llvm/test/tools/llvm-cov/Inputs/branch-logical-mixed.cpp b/llvm/test/tools/llvm-cov/Inputs/branch-logical-mixed.cpp
index 0eaf4c963ef9f4..7665a88466ac89 100644
--- a/llvm/test/tools/llvm-cov/Inputs/branch-logical-mixed.cpp
+++ b/llvm/test/tools/llvm-cov/Inputs/branch-logical-mixed.cpp
@@ -53,22 +53,22 @@ void func(int a, int b) {
(b5 || // BRCOV: Branch ([[@LINE]]:13): [True: 1, False: [[C2]]]
b0); // BRCOV: Branch ([[@LINE]]:13): [True: [[C2]], False: 0]
- if (c) // BRCOV: Branch ([[@LINE]]:7): [True: 0, False: [[C4]]]
+ if (c) // CHECK: Branch ([[@LINE]]:7): [True: 0, False: [[C4]]]
printf("case0\n");
else
printf("case1\n");
- if (d) // BRCOV: Branch ([[@LINE]]:7): [True: [[C4]], False: 0]
+ if (d) // CHECK: Branch ([[@LINE]]:7): [True: [[C4]], False: 0]
printf("case2\n");
else
printf("case3\n");
- if (e) // BRCOV: Branch ([[@LINE]]:7): [True: 1, False: [[C3]]]
+ if (e) // CHECK: Branch ([[@LINE]]:7): [True: 1, False: [[C3:3|1]]]
printf("case4\n");
else
printf("case5\n");
- if (f) // BRCOV: Branch ([[@LINE]]:7): [True: [[C3]], False: 1]
+ if (f) // CHECK: Branch ([[@LINE]]:7): [True: [[C3]], False: 1]
printf("case6\n");
else
printf("case7\n");
diff --git a/llvm/test/tools/llvm-cov/Inputs/branch-templates-single.proftext b/llvm/test/tools/llvm-cov/Inputs/branch-templates-single.proftext
index 829431334478f3..42cb368bd186eb 100644
--- a/llvm/test/tools/llvm-cov/Inputs/branch-templates-single.proftext
+++ b/llvm/test/tools/llvm-cov/Inputs/branch-templates-single.proftext
@@ -4,34 +4,31 @@ _Z4funcIbEiT_
# Func Hash:
11045778961
# Num Counters:
-4
+3
# Counter Values:
1
1
0
-0
_Z4funcIfEiT_
# Func Hash:
11045778961
# Num Counters:
-4
+3
# Counter Values:
1
0
1
-0
_Z4funcIiEiT_
# Func Hash:
11045778961
# Num Counters:
-4
+3
# Counter Values:
1
0
1
-0
main
# Func Hash:
@@ -41,9 +38,9 @@ main
# Counter Values:
1
1
-1
0
1
+0
1
-1
+0
diff --git a/llvm/test/tools/llvm-cov/Inputs/branch-templates-single.yaml b/llvm/test/tools/llvm-cov/Inputs/branch-templates-single.yaml
index d4ede6db448e61..de145925c6bab9 100644
--- a/llvm/test/tools/llvm-cov/Inputs/branch-templates-single.yaml
+++ b/llvm/test/tools/llvm-cov/Inputs/branch-templates-single.yaml
@@ -11,22 +11,22 @@ Sections:
Type: SHT_PROGBITS
Flags: [ SHF_GNU_RETAIN ]
AddressAlign: 0x8
- Content: FAD58DE7366495DB5100000058242991A444920226ED9A40DAABBC6B0101000D011D0C090201010700130500140185808080080501050016090103060209000700170D00180185808080080D01050016110103040211000700171500180185808080081501050016190103010B
+ Content: FAD58DE7366495DB5700000058242991A444920226ED9A40DAABBC6B0101000D011D0C0902010107001320051100070013050014018580808008050105001601010700172009150007001709001801858080800809010500160101070017200D19000700170D00180185808080080D01050016
- Name: '__llvm_covfun (1)'
Type: SHT_PROGBITS
Flags: [ SHF_GNU_RETAIN ]
AddressAlign: 0x8
- Content: 5427717259E0E43E38000000113661920200000026ED9A40DAABBC6B01010008010D0F06020101060007050008018580808008050105000D09000E028580808008090205000D0D000E0183808080080D01030102
+ Content: 5427717259E0E43E3F000000113661920200000026ED9A40DAABBC6B01010009010D0F0602010106000720050900060007050008018580808008050105000D09000E028580808008090205000D00000E0183808080080001030102
- Name: '__llvm_covfun (2)'
Type: SHT_PROGBITS
Flags: [ SHF_GNU_RETAIN ]
AddressAlign: 0x8
- Content: 4B7E22082F0551AA38000000113661920200000026ED9A40DAABBC6B01010008010D0F06020101060007050008018580808008050105000D09000E028580808008090205000D0D000E0183808080080D01030102
+ Content: 4B7E22082F0551AA3F000000113661920200000026ED9A40DAABBC6B01010009010D0F0602010106000720050900060007050008018580808008050105000D09000E028580808008090205000D00000E0183808080080001030102
- Name: '__llvm_covfun (3)'
Type: SHT_PROGBITS
Flags: [ SHF_GNU_RETAIN ]
AddressAlign: 0x8
- Content: AC1440BC3DA3E41A38000000113661920200000026ED9A40DAABBC6B01010008010D0F06020101060007050008018580808008050105000D09000E028580808008090205000D0D000E0183808080080D01030102
+ Content: AC1440BC3DA3E41A3F000000113661920200000026ED9A40DAABBC6B01010009010D0F0602010106000720050900060007050008018580808008050105000D09000E028580808008090205000D00000E0183808080080001030102
- Name: __llvm_covmap
Type: SHT_PROGBITS
Flags: [ SHF_GNU_RETAIN ]
@@ -58,24 +58,24 @@ Symbols:
Type: STT_OBJECT
Section: __llvm_covfun
Binding: STB_WEAK
- Size: 0x6D
+ Size: 0x73
Other: [ STV_HIDDEN ]
- Name: __covrec_3EE4E05972712754u
Type: STT_OBJECT
Section: '__llvm_covfun (1)'
Binding: STB_WEAK
- Size: 0x54
+ Size: 0x5B
Other: [ STV_HIDDEN ]
- Name: __covrec_AA51052F08227E4Bu
Type: STT_OBJECT
Section: '__llvm_covfun (2)'
Binding: STB_WEAK
- Size: 0x54
+ Size: 0x5B
Other: [ STV_HIDDEN ]
- Name: __covrec_1AE4A33DBC4014ACu
Type: STT_OBJECT
Section: '__llvm_covfun (3)'
Binding: STB_WEAK
- Size: 0x54
+ Size: 0x5B
Other: [ STV_HIDDEN ]
...
diff --git a/llvm/test/tools/llvm-cov/Inputs/branch-templates.cpp b/llvm/test/tools/llvm-cov/Inputs/branch-templates.cpp
index 4d932eaf5944a8..597e596ae84d5c 100644
--- a/llvm/test/tools/llvm-cov/Inputs/branch-templates.cpp
+++ b/llvm/test/tools/llvm-cov/Inputs/branch-templates.cpp
@@ -11,27 +11,27 @@ void unused(T x) {
template<typename T>
int func(T x) {
- if(x) // BRCOV: | Branch ([[@LINE]]:6): [True: 0, False: 1]
- return 0; // BRCOV: | Branch ([[@LINE-1]]:6): [True: 1, False: 0]
- else // BRCOV: | Branch ([[@LINE-2]]:6): [True: 0, False: 1]
+ if(x) // CHECK: | Branch ([[@LINE]]:6): [True: 0, False: 1]
+ return 0; // CHECK: | Branch ([[@LINE-1]]:6): [True: 1, False: 0]
+ else // CHECK: | Branch ([[@LINE-2]]:6): [True: 0, False: 1]
return 1;
int j = 1;
}
// CHECK-LABEL: _Z4funcIiEiT_:
- // BRCOV: | | Branch ([[@LINE-8]]:6): [True: 0, False: 1]
+ // CHECK: | | Branch ([[@LINE-8]]:6): [True: 0, False: 1]
// CHECK-LABEL: _Z4funcIbEiT_:
- // BRCOV: | | Branch ([[@LINE-10]]:6): [True: 1, False: 0]
+ // CHECK: | | Branch ([[@LINE-10]]:6): [True: 1, False: 0]
// CHECK-LABEL: _Z4funcIfEiT_:
- // BRCOV: | | Branch ([[@LINE-12]]:6): [True: 0, False: 1]
+ // CHECK: | | Branch ([[@LINE-12]]:6): [True: 0, False: 1]
int main() {
- if (func<int>(0)) // BRCOV: | Branch ([[@LINE]]:7): [True: 1, False: 0]
+ if (func<int>(0)) // CHECK: | Branch ([[@LINE]]:7): [True: 1, False: 0]
printf("case1\n");
- if (func<bool>(true)) // BRCOV: | Branch ([[@LINE]]:7): [True: 0, False: 1]
+ if (func<bool>(true)) // CHECK: | Branch ([[@LINE]]:7): [True: 0, False: 1]
printf("case2\n");
- if (func<float>(0.0)) // BRCOV: | Branch ([[@LINE]]:7): [True: 1, False: 0]
+ if (func<float>(0.0)) // CHECK: | Branch ([[@LINE]]:7): [True: 1, False: 0]
printf("case3\n");
(void)0;
return 0;
diff --git a/llvm/test/tools/llvm-cov/Inputs/showLineExecutionCounts-single.proftext b/llvm/test/tools/llvm-cov/Inputs/showLineExecutionCounts-single.proftext
index 1b7b949de49625..cfaaf8c3fc631a 100644
--- a/llvm/test/tools/llvm-cov/Inputs/showLineExecutionCounts-single.proftext
+++ b/llvm/test/tools/llvm-cov/Inputs/showLineExecutionCounts-single.proftext
@@ -4,7 +4,7 @@ main
# Func Hash:
15239891155360101223
# Num Counters:
-14
+13
# Counter Values:
161
0
@@ -14,10 +14,9 @@ main
161
161
161
-161
-161
0
161
0
161
+161
diff --git a/llvm/test/tools/llvm-cov/Inputs/showLineExecutionCounts-single.yaml b/llvm/test/tools/llvm-cov/Inputs/showLineExecutionCounts-single.yaml
index 84b184023f0822..f1cca420c1d108 100644
--- a/llvm/test/tools/llvm-cov/Inputs/showLineExecutionCounts-single.yaml
+++ b/llvm/test/tools/llvm-cov/Inputs/showLineExecutionCounts-single.yaml
@@ -11,7 +11,7 @@ Sections:
Type: SHT_PROGBITS
Flags: [ SHF_GNU_RETAIN ]
AddressAlign: 0x8
- Content: FAD58DE7366495DB9A0000006733DBEA42F87ED3C60E0B951FF3509D0101001A01060C130210020100010101070008050009008A8080800805000A0204090204008A8080800809000A020410030100010D01030A02110013001A15001C001F19002000A180808008190021020410030100011D010306021D0007000D25000F0090808080082500100015290018001D2101030502210007000D31000F018980808008310109000E350109000E10010100012D0103000B
+ Content: FAD58DE7366495DB9C0000006733DBEA42F87ED3C60E0B951FF3509D0101001A01060C13021002010001010107000820053100070008050009008A8080800805000A0204310204008A8080800831000A02041003010001090113001A0D001C001F11002000A180808008110021020410030100011501030602150007000D1D000F0090808080081D00100015210018001D1901030502190007000D29000F018980808008290109000E2D0109000E1001010001250103000B
- Name: __llvm_covmap
Type: SHT_PROGBITS
Flags: [ SHF_GNU_RETAIN ]
@@ -40,6 +40,6 @@ Symbols:
Type: STT_OBJECT
Section: __llvm_covfun
Binding: STB_WEAK
- Size: 0xB6
+ Size: 0xB8
Other: [ STV_HIDDEN ]
...
diff --git a/llvm/test/tools/llvm-cov/branch-templates.test b/llvm/test/tools/llvm-cov/branch-templates.test
index d5535022239f5f..6454c4ad8dd35f 100644
--- a/llvm/test/tools/llvm-cov/branch-templates.test
+++ b/llvm/test/tools/llvm-cov/branch-templates.test
@@ -6,6 +6,8 @@
// RUN: yaml2obj %S/Inputs/branch-templates-single.yaml -o %t.o
// RUN: llvm-profdata merge %S/Inputs/branch-templates-single.proftext -o %t.profdata
// RUN: llvm-cov show --show-expansions --show-branches=count %t.o -instr-profile %t.profdata -path-equivalence=.,%S/Inputs | FileCheck %S/Inputs/branch-templates.cpp
+// RUN: llvm-cov report --show-branch-summary %t.o -instr-profile %t.profdata -show-functions -path-equivalence=.,%S/Inputs %S/Inputs/branch-templates.cpp | FileCheck %s -check-prefix=REPORT
+// RUN: llvm-cov report --show-branch-summary %t.o -instr-profile %t.profdata -path-equivalence=.,%S/Inputs | FileCheck %s -check-prefix=REPORTFILE
// REPORT: Name Regions Miss Cover Lines Miss Cover Branches Miss Cover
// REPORT-NEXT: ---
More information about the llvm-branch-commits
mailing list