Author: NAKAMURA Takumi
Date: 2026-01-29T14:53:18+09:00
New Revision: b6c412814a946b060561c6d88043f8b44180c3a2

URL: 
https://github.com/llvm/llvm-project/commit/b6c412814a946b060561c6d88043f8b44180c3a2
DIFF: 
https://github.com/llvm/llvm-project/commit/b6c412814a946b060561c6d88043f8b44180c3a2.diff

LOG: [Coverage][Single] Enable Branch coverage for `BinLAnd` and `BinLOr` 
(#113113)

Depends on: #113109 #113110 #113111


https://discourse.llvm.org/t/rfc-integrating-singlebytecoverage-with-branch-coverage/82492

Added: 
    

Modified: 
    clang/docs/ReleaseNotes.rst
    clang/lib/CodeGen/CGExprScalar.cpp
    clang/lib/CodeGen/CodeGenFunction.cpp
    clang/lib/CodeGen/CoverageMappingGen.cpp
    llvm/test/tools/llvm-cov/Inputs/branch-c-general-single.proftext
    llvm/test/tools/llvm-cov/Inputs/branch-c-general-single.yaml
    llvm/test/tools/llvm-cov/Inputs/branch-c-general.c
    llvm/test/tools/llvm-cov/Inputs/branch-logical-mixed-single.proftext
    llvm/test/tools/llvm-cov/Inputs/branch-logical-mixed-single.yaml
    llvm/test/tools/llvm-cov/Inputs/branch-logical-mixed.cpp
    llvm/test/tools/llvm-cov/Inputs/branch-macros-single.proftext
    llvm/test/tools/llvm-cov/Inputs/branch-macros-single.yaml
    llvm/test/tools/llvm-cov/Inputs/branch-macros.cpp
    llvm/test/tools/llvm-cov/branch-macros.test

Removed: 
    


################################################################################
diff  --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst
index bec7c21101e24..56a0380a43be7 100644
--- a/clang/docs/ReleaseNotes.rst
+++ b/clang/docs/ReleaseNotes.rst
@@ -205,6 +205,9 @@ Improvements to Clang's time-trace
 Improvements to Coverage Mapping
 --------------------------------
 
+- "Single byte coverage" now supports branch coverage and can be used
+  together with ``-fcoverage-mcdc``.
+
 Bug Fixes in This Version
 -------------------------
 - Fixed a failed assertion in the preprocessor when ``__has_embed`` parameters 
are missing parentheses. (#GH175088)

diff  --git a/clang/lib/CodeGen/CGExprScalar.cpp 
b/clang/lib/CodeGen/CGExprScalar.cpp
index 15585d6d038b9..1b1bc4a11741e 100644
--- a/clang/lib/CodeGen/CGExprScalar.cpp
+++ b/clang/lib/CodeGen/CGExprScalar.cpp
@@ -5348,6 +5348,9 @@ Value *ScalarExprEmitter::VisitBinAssign(const 
BinaryOperator *E) {
 }
 
 Value *ScalarExprEmitter::VisitBinLAnd(const BinaryOperator *E) {
+  auto HasLHSSkip = CGF.hasSkipCounter(E);
+  auto HasRHSSkip = CGF.hasSkipCounter(E->getRHS());
+
   // Perform vector logical and on comparisons with zero vectors.
   if (E->getType()->isVectorType()) {
     CGF.incrementProfileCounter(E);
@@ -5376,7 +5379,7 @@ Value *ScalarExprEmitter::VisitBinLAnd(const 
BinaryOperator *E) {
   bool LHSCondVal;
   if (CGF.ConstantFoldsToSimpleInteger(E->getLHS(), LHSCondVal)) {
     if (LHSCondVal) { // If we have 1 && X, just emit X.
-      CGF.incrementProfileCounter(E);
+      CGF.incrementProfileCounter(CGF.UseExecPath, E, /*UseBoth=*/true);
 
       // If the top of the logical operator nest, reset the MCDC temp to 0.
       if (CGF.isMCDCDecisionExpr(E))
@@ -5392,11 +5395,17 @@ Value *ScalarExprEmitter::VisitBinLAnd(const 
BinaryOperator *E) {
           CodeGenFunction::isInstrumentedCondition(E->getRHS())) {
         CGF.maybeUpdateMCDCCondBitmap(E->getRHS(), RHSCond);
         llvm::BasicBlock *FBlock = CGF.createBasicBlock("land.end");
+        llvm::BasicBlock *RHSSkip =
+            (HasRHSSkip ? CGF.createBasicBlock("land.rhsskip") : FBlock);
         llvm::BasicBlock *RHSBlockCnt = CGF.createBasicBlock("land.rhscnt");
-        Builder.CreateCondBr(RHSCond, RHSBlockCnt, FBlock);
+        Builder.CreateCondBr(RHSCond, RHSBlockCnt, RHSSkip);
         CGF.EmitBlock(RHSBlockCnt);
-        CGF.incrementProfileCounter(E->getRHS());
+        CGF.incrementProfileCounter(CGF.UseExecPath, E->getRHS());
         CGF.EmitBranch(FBlock);
+        if (HasRHSSkip) {
+          CGF.EmitBlock(RHSSkip);
+          CGF.incrementProfileCounter(CGF.UseSkipPath, E->getRHS());
+        }
         CGF.EmitBlock(FBlock);
       } else
         CGF.markStmtMaybeUsed(E->getRHS());
@@ -5411,7 +5420,12 @@ Value *ScalarExprEmitter::VisitBinLAnd(const 
BinaryOperator *E) {
 
     // 0 && RHS: If it is safe, just elide the RHS, and return 0/false.
     if (!CGF.ContainsLabel(E->getRHS())) {
+      CGF.markStmtAsUsed(false, E);
+      if (HasLHSSkip)
+        CGF.incrementProfileCounter(CGF.UseSkipPath, E);
+
       CGF.markStmtMaybeUsed(E->getRHS());
+
       return llvm::Constant::getNullValue(ResTy);
     }
   }
@@ -5423,12 +5437,21 @@ Value *ScalarExprEmitter::VisitBinLAnd(const 
BinaryOperator *E) {
   llvm::BasicBlock *ContBlock = CGF.createBasicBlock("land.end");
   llvm::BasicBlock *RHSBlock  = CGF.createBasicBlock("land.rhs");
 
+  llvm::BasicBlock *LHSFalseBlock =
+      (HasLHSSkip ? CGF.createBasicBlock("land.lhsskip") : ContBlock);
+
   CodeGenFunction::ConditionalEvaluation eval(CGF);
 
   // Branch on the LHS first.  If it is false, go to the failure (cont) block.
-  CGF.EmitBranchOnBoolExpr(E->getLHS(), RHSBlock, ContBlock,
+  CGF.EmitBranchOnBoolExpr(E->getLHS(), RHSBlock, LHSFalseBlock,
                            CGF.getProfileCount(E->getRHS()));
 
+  if (HasLHSSkip) {
+    CGF.EmitBlock(LHSFalseBlock);
+    CGF.incrementProfileCounter(CGF.UseSkipPath, E);
+    CGF.EmitBranch(ContBlock);
+  }
+
   // Any edges into the ContBlock are now from an (indeterminate number of)
   // edges from this first condition.  All of these values will be false.  
Start
   // setting up the PHI node in the Cont Block for this.
@@ -5440,7 +5463,7 @@ Value *ScalarExprEmitter::VisitBinLAnd(const 
BinaryOperator *E) {
 
   eval.begin(CGF);
   CGF.EmitBlock(RHSBlock);
-  CGF.incrementProfileCounter(E);
+  CGF.incrementProfileCounter(CGF.UseExecPath, E);
   Value *RHSCond = CGF.EvaluateExprAsBool(E->getRHS());
   eval.end(CGF);
 
@@ -5450,15 +5473,24 @@ Value *ScalarExprEmitter::VisitBinLAnd(const 
BinaryOperator *E) {
   // If we're generating for profiling or coverage, generate a branch on the
   // RHS to a block that increments the RHS true counter needed to track branch
   // condition coverage.
+  llvm::BasicBlock *ContIncoming = RHSBlock;
   if (InstrumentRegions &&
       CodeGenFunction::isInstrumentedCondition(E->getRHS())) {
     CGF.maybeUpdateMCDCCondBitmap(E->getRHS(), RHSCond);
     llvm::BasicBlock *RHSBlockCnt = CGF.createBasicBlock("land.rhscnt");
-    Builder.CreateCondBr(RHSCond, RHSBlockCnt, ContBlock);
+    llvm::BasicBlock *RHSBlockSkip =
+        (HasRHSSkip ? CGF.createBasicBlock("land.rhsskip") : ContBlock);
+    Builder.CreateCondBr(RHSCond, RHSBlockCnt, RHSBlockSkip);
     CGF.EmitBlock(RHSBlockCnt);
-    CGF.incrementProfileCounter(E->getRHS());
+    CGF.incrementProfileCounter(CGF.UseExecPath, E->getRHS());
     CGF.EmitBranch(ContBlock);
     PN->addIncoming(RHSCond, RHSBlockCnt);
+    if (HasRHSSkip) {
+      CGF.EmitBlock(RHSBlockSkip);
+      CGF.incrementProfileCounter(CGF.UseSkipPath, E->getRHS());
+      CGF.EmitBranch(ContBlock);
+      ContIncoming = RHSBlockSkip;
+    }
   }
 
   // Emit an unconditional branch from this block to ContBlock.
@@ -5468,7 +5500,7 @@ Value *ScalarExprEmitter::VisitBinLAnd(const 
BinaryOperator *E) {
     CGF.EmitBlock(ContBlock);
   }
   // Insert an entry into the phi node for the edge with the value of RHSCond.
-  PN->addIncoming(RHSCond, RHSBlock);
+  PN->addIncoming(RHSCond, ContIncoming);
 
   // If the top of the logical operator nest, update the MCDC bitmap.
   if (CGF.isMCDCDecisionExpr(E))
@@ -5485,6 +5517,9 @@ Value *ScalarExprEmitter::VisitBinLAnd(const 
BinaryOperator *E) {
 }
 
 Value *ScalarExprEmitter::VisitBinLOr(const BinaryOperator *E) {
+  auto HasLHSSkip = CGF.hasSkipCounter(E);
+  auto HasRHSSkip = CGF.hasSkipCounter(E->getRHS());
+
   // Perform vector logical or on comparisons with zero vectors.
   if (E->getType()->isVectorType()) {
     CGF.incrementProfileCounter(E);
@@ -5513,7 +5548,7 @@ Value *ScalarExprEmitter::VisitBinLOr(const 
BinaryOperator *E) {
   bool LHSCondVal;
   if (CGF.ConstantFoldsToSimpleInteger(E->getLHS(), LHSCondVal)) {
     if (!LHSCondVal) { // If we have 0 || X, just emit X.
-      CGF.incrementProfileCounter(E);
+      CGF.incrementProfileCounter(CGF.UseExecPath, E, /*UseBoth=*/true);
 
       // If the top of the logical operator nest, reset the MCDC temp to 0.
       if (CGF.isMCDCDecisionExpr(E))
@@ -5529,11 +5564,17 @@ Value *ScalarExprEmitter::VisitBinLOr(const 
BinaryOperator *E) {
           CodeGenFunction::isInstrumentedCondition(E->getRHS())) {
         CGF.maybeUpdateMCDCCondBitmap(E->getRHS(), RHSCond);
         llvm::BasicBlock *FBlock = CGF.createBasicBlock("lor.end");
+        llvm::BasicBlock *RHSSkip =
+            (HasRHSSkip ? CGF.createBasicBlock("lor.rhsskip") : FBlock);
         llvm::BasicBlock *RHSBlockCnt = CGF.createBasicBlock("lor.rhscnt");
-        Builder.CreateCondBr(RHSCond, FBlock, RHSBlockCnt);
+        Builder.CreateCondBr(RHSCond, RHSSkip, RHSBlockCnt);
         CGF.EmitBlock(RHSBlockCnt);
-        CGF.incrementProfileCounter(E->getRHS());
+        CGF.incrementProfileCounter(CGF.UseExecPath, E->getRHS());
         CGF.EmitBranch(FBlock);
+        if (HasRHSSkip) {
+          CGF.EmitBlock(RHSSkip);
+          CGF.incrementProfileCounter(CGF.UseSkipPath, E->getRHS());
+        }
         CGF.EmitBlock(FBlock);
       } else
         CGF.markStmtMaybeUsed(E->getRHS());
@@ -5548,7 +5589,12 @@ Value *ScalarExprEmitter::VisitBinLOr(const 
BinaryOperator *E) {
 
     // 1 || RHS: If it is safe, just elide the RHS, and return 1/true.
     if (!CGF.ContainsLabel(E->getRHS())) {
+      CGF.markStmtAsUsed(false, E);
+      if (HasLHSSkip)
+        CGF.incrementProfileCounter(CGF.UseSkipPath, E);
+
       CGF.markStmtMaybeUsed(E->getRHS());
+
       return llvm::ConstantInt::get(ResTy, 1);
     }
   }
@@ -5559,14 +5605,22 @@ Value *ScalarExprEmitter::VisitBinLOr(const 
BinaryOperator *E) {
 
   llvm::BasicBlock *ContBlock = CGF.createBasicBlock("lor.end");
   llvm::BasicBlock *RHSBlock = CGF.createBasicBlock("lor.rhs");
+  llvm::BasicBlock *LHSTrueBlock =
+      (HasLHSSkip ? CGF.createBasicBlock("lor.lhsskip") : ContBlock);
 
   CodeGenFunction::ConditionalEvaluation eval(CGF);
 
   // Branch on the LHS first.  If it is true, go to the success (cont) block.
-  CGF.EmitBranchOnBoolExpr(E->getLHS(), ContBlock, RHSBlock,
+  CGF.EmitBranchOnBoolExpr(E->getLHS(), LHSTrueBlock, RHSBlock,
                            CGF.getCurrentProfileCount() -
                                CGF.getProfileCount(E->getRHS()));
 
+  if (HasLHSSkip) {
+    CGF.EmitBlock(LHSTrueBlock);
+    CGF.incrementProfileCounter(CGF.UseSkipPath, E);
+    CGF.EmitBranch(ContBlock);
+  }
+
   // Any edges into the ContBlock are now from an (indeterminate number of)
   // edges from this first condition.  All of these values will be true.  Start
   // setting up the PHI node in the Cont Block for this.
@@ -5580,7 +5634,7 @@ Value *ScalarExprEmitter::VisitBinLOr(const 
BinaryOperator *E) {
 
   // Emit the RHS condition as a bool value.
   CGF.EmitBlock(RHSBlock);
-  CGF.incrementProfileCounter(E);
+  CGF.incrementProfileCounter(CGF.UseExecPath, E);
   Value *RHSCond = CGF.EvaluateExprAsBool(E->getRHS());
 
   eval.end(CGF);
@@ -5591,21 +5645,30 @@ Value *ScalarExprEmitter::VisitBinLOr(const 
BinaryOperator *E) {
   // If we're generating for profiling or coverage, generate a branch on the
   // RHS to a block that increments the RHS true counter needed to track branch
   // condition coverage.
+  llvm::BasicBlock *ContIncoming = RHSBlock;
   if (InstrumentRegions &&
       CodeGenFunction::isInstrumentedCondition(E->getRHS())) {
     CGF.maybeUpdateMCDCCondBitmap(E->getRHS(), RHSCond);
     llvm::BasicBlock *RHSBlockCnt = CGF.createBasicBlock("lor.rhscnt");
-    Builder.CreateCondBr(RHSCond, ContBlock, RHSBlockCnt);
+    llvm::BasicBlock *RHSTrueBlock =
+        (HasRHSSkip ? CGF.createBasicBlock("lor.rhsskip") : ContBlock);
+    Builder.CreateCondBr(RHSCond, RHSTrueBlock, RHSBlockCnt);
     CGF.EmitBlock(RHSBlockCnt);
-    CGF.incrementProfileCounter(E->getRHS());
+    CGF.incrementProfileCounter(CGF.UseExecPath, E->getRHS());
     CGF.EmitBranch(ContBlock);
     PN->addIncoming(RHSCond, RHSBlockCnt);
+    if (HasRHSSkip) {
+      CGF.EmitBlock(RHSTrueBlock);
+      CGF.incrementProfileCounter(CGF.UseSkipPath, E->getRHS());
+      CGF.EmitBranch(ContBlock);
+      ContIncoming = RHSTrueBlock;
+    }
   }
 
   // Emit an unconditional branch from this block to ContBlock.  Insert an 
entry
   // into the phi node for the edge with the value of RHSCond.
   CGF.EmitBlock(ContBlock);
-  PN->addIncoming(RHSCond, RHSBlock);
+  PN->addIncoming(RHSCond, ContIncoming);
 
   // If the top of the logical operator nest, update the MCDC bitmap.
   if (CGF.isMCDCDecisionExpr(E))

diff  --git a/clang/lib/CodeGen/CodeGenFunction.cpp 
b/clang/lib/CodeGen/CodeGenFunction.cpp
index 1e66c22759fa9..61128316963ac 100644
--- a/clang/lib/CodeGen/CodeGenFunction.cpp
+++ b/clang/lib/CodeGen/CodeGenFunction.cpp
@@ -1823,6 +1823,10 @@ void CodeGenFunction::EmitBranchToCounterBlock(
   // Create the block we'll use to increment the appropriate counter.
   llvm::BasicBlock *CounterIncrBlock = createBasicBlock("lop.rhscnt");
 
+  llvm::BasicBlock *SkipIncrBlock =
+      (hasSkipCounter(CntrStmt) ? createBasicBlock("lop.rhsskip") : nullptr);
+  llvm::BasicBlock *SkipNextBlock = nullptr;
+
   // Set block pointers according to Logical-AND (BO_LAnd) semantics. This
   // means we need to evaluate the condition and increment the counter on TRUE:
   //
@@ -1836,8 +1840,9 @@ void CodeGenFunction::EmitBranchToCounterBlock(
   //   goto TrueBlock;
 
   if (LOp == BO_LAnd) {
+    SkipNextBlock = FalseBlock;
     ThenBlock = CounterIncrBlock;
-    ElseBlock = FalseBlock;
+    ElseBlock = (SkipIncrBlock ? SkipIncrBlock : SkipNextBlock);
     NextBlock = TrueBlock;
   }
 
@@ -1854,7 +1859,8 @@ void CodeGenFunction::EmitBranchToCounterBlock(
   //   goto FalseBlock;
 
   else if (LOp == BO_LOr) {
-    ThenBlock = TrueBlock;
+    SkipNextBlock = TrueBlock;
+    ThenBlock = (SkipIncrBlock ? SkipIncrBlock : SkipNextBlock);
     ElseBlock = CounterIncrBlock;
     NextBlock = FalseBlock;
   } else {
@@ -1864,11 +1870,17 @@ void CodeGenFunction::EmitBranchToCounterBlock(
   // Emit Branch based on condition.
   EmitBranchOnBoolExpr(Cond, ThenBlock, ElseBlock, TrueCount, LH);
 
+  if (SkipIncrBlock) {
+    EmitBlock(SkipIncrBlock);
+    incrementProfileCounter(UseSkipPath, CntrStmt);
+    EmitBranch(SkipNextBlock);
+  }
+
   // Emit the block containing the counter increment(s).
   EmitBlock(CounterIncrBlock);
 
   // Increment corresponding counter; if index not provided, use Cond as index.
-  incrementProfileCounter(CntrStmt);
+  incrementProfileCounter(UseExecPath, CntrStmt);
 
   // Go to the next block.
   EmitBranch(NextBlock);
@@ -1888,6 +1900,8 @@ void CodeGenFunction::EmitBranchOnBoolExpr(
   Cond = Cond->IgnoreParens();
 
   if (const BinaryOperator *CondBOp = dyn_cast<BinaryOperator>(Cond)) {
+    bool HasSkip = hasSkipCounter(CondBOp);
+
     // Handle X && Y in a condition.
     if (CondBOp->getOpcode() == BO_LAnd) {
       // If we have "1 && X", simplify the code.  "0 && X" would have constant
@@ -1915,6 +1929,8 @@ void CodeGenFunction::EmitBranchOnBoolExpr(
       // Emit the LHS as a conditional.  If the LHS conditional is false, we
       // want to jump to the FalseBlock.
       llvm::BasicBlock *LHSTrue = createBasicBlock("land.lhs.true");
+      llvm::BasicBlock *LHSFalse =
+          (HasSkip ? createBasicBlock("land.lhsskip") : FalseBlock);
       // The counter tells us how often we evaluate RHS, and all of TrueCount
       // can be propagated to that branch.
       uint64_t RHSCount = getProfileCount(CondBOp->getRHS());
@@ -1925,12 +1941,17 @@ void CodeGenFunction::EmitBranchOnBoolExpr(
         // Propagate the likelihood attribute like __builtin_expect
         // __builtin_expect(X && Y, 1) -> X and Y are likely
         // __builtin_expect(X && Y, 0) -> only Y is unlikely
-        EmitBranchOnBoolExpr(CondBOp->getLHS(), LHSTrue, FalseBlock, RHSCount,
+        EmitBranchOnBoolExpr(CondBOp->getLHS(), LHSTrue, LHSFalse, RHSCount,
                              LH == Stmt::LH_Unlikely ? Stmt::LH_None : LH);
+        if (HasSkip) {
+          EmitBlock(LHSFalse);
+          incrementProfileCounter(UseSkipPath, CondBOp);
+          EmitBranch(FalseBlock);
+        }
         EmitBlock(LHSTrue);
       }
 
-      incrementProfileCounter(CondBOp);
+      incrementProfileCounter(UseExecPath, CondBOp);
       setCurrentProfileCount(getProfileCount(CondBOp->getRHS()));
 
       // Any temporaries created here are conditional.
@@ -1965,6 +1986,8 @@ void CodeGenFunction::EmitBranchOnBoolExpr(
       }
       // Emit the LHS as a conditional.  If the LHS conditional is true, we
       // want to jump to the TrueBlock.
+      llvm::BasicBlock *LHSTrue =
+          (HasSkip ? createBasicBlock("lor.lhsskip") : TrueBlock);
       llvm::BasicBlock *LHSFalse = createBasicBlock("lor.lhs.false");
       // We have the count for entry to the RHS and for the whole expression
       // being true, so we can divy up True count between the short circuit and
@@ -1979,12 +2002,17 @@ void CodeGenFunction::EmitBranchOnBoolExpr(
         // __builtin_expect(X || Y, 1) -> only Y is likely
         // __builtin_expect(X || Y, 0) -> both X and Y are unlikely
         ApplyDebugLocation DL(*this, Cond);
-        EmitBranchOnBoolExpr(CondBOp->getLHS(), TrueBlock, LHSFalse, LHSCount,
+        EmitBranchOnBoolExpr(CondBOp->getLHS(), LHSTrue, LHSFalse, LHSCount,
                              LH == Stmt::LH_Likely ? Stmt::LH_None : LH);
+        if (HasSkip) {
+          EmitBlock(LHSTrue);
+          incrementProfileCounter(UseSkipPath, CondBOp);
+          EmitBranch(TrueBlock);
+        }
         EmitBlock(LHSFalse);
       }
 
-      incrementProfileCounter(CondBOp);
+      incrementProfileCounter(UseExecPath, CondBOp);
       setCurrentProfileCount(getProfileCount(CondBOp->getRHS()));
 
       // Any temporaries created here are conditional.

diff  --git a/clang/lib/CodeGen/CoverageMappingGen.cpp 
b/clang/lib/CodeGen/CoverageMappingGen.cpp
index e2b962c081723..803037d1874b3 100644
--- a/clang/lib/CodeGen/CoverageMappingGen.cpp
+++ b/clang/lib/CodeGen/CoverageMappingGen.cpp
@@ -983,22 +983,12 @@ struct CounterCoverageMappingBuilder
   ///
   /// \param S Key to the CounterMap
   /// \param ParentCnt The Counter representing how many times S is evaluated.
-  /// \param SkipCntForOld (To be removed later) Optional fake Counter
-  ///                      to override Skipped for adjustment of
-  ///                      expressions in the old behavior of
-  ///                      EnableSingleByteCoverage that is unaware of
-  ///                      Branch coverage.
   BranchCounterPair
   getBranchCounterPair(const Stmt *S, Counter ParentCnt,
                        std::optional<Counter> SkipCntForOld = std::nullopt) {
     auto &TheMap = CounterMap[S];
     auto ExecCnt = Counter::getCounter(TheMap.Executed);
 
-    // The old behavior of SingleByte is unaware of Branches.
-    // Will be pruned after the migration of SingleByte.
-    if (llvm::EnableSingleByteCoverage && SkipCntForOld)
-      return {ExecCnt, *SkipCntForOld};
-
     BranchCounterPair Counters = {ExecCnt,
                                   Builder.subtract(ParentCnt, ExecCnt)};
 
@@ -2328,9 +2318,6 @@ struct CounterCoverageMappingBuilder
     extendRegion(E->getRHS());
     propagateCounts(getRegionCounter(E), E->getRHS());
 
-    if (llvm::EnableSingleByteCoverage)
-      return;
-
     // Extract the Parent Region Counter.
     Counter ParentCnt = getRegion().getCounter();
 
@@ -2399,9 +2386,6 @@ struct CounterCoverageMappingBuilder
     extendRegion(E->getRHS());
     propagateCounts(getRegionCounter(E), E->getRHS());
 
-    if (llvm::EnableSingleByteCoverage)
-      return;
-
     // Extract the Parent Region Counter.
     Counter ParentCnt = getRegion().getCounter();
 

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 44bd4ee7a9acf..d2e90148988f9 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
@@ -36,7 +36,7 @@ boolean_operators
 # Func Hash:
 1245693242827665
 # Num Counters:
-14
+26
 # Counter Values:
 1
 1
@@ -52,12 +52,24 @@ boolean_operators
 1
 1
 1
+1
+1
+1
+0
+1
+1
+1
+1
+1
+1
+1
+0
 
 boolop_loops
 # Func Hash:
 873389568252105055
 # Num Counters:
-13
+21
 # Counter Values:
 1
 1
@@ -72,6 +84,14 @@ boolop_loops
 1
 1
 1
+0
+1
+1
+1
+0
+1
+1
+1
 
 branch-c-general.c:static_func
 # Func Hash:
@@ -98,7 +118,7 @@ conditionals
 # Func Hash:
 293081517422662482
 # Num Counters:
-20
+24
 # Counter Values:
 1
 1
@@ -119,6 +139,10 @@ conditionals
 0
 1
 1
+0
+1
+1
+0
 1
 
 do_fallthrough

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 c8f8f41f9a5d1..894df26124fd3 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,7 +16,7 @@ Sections:
     Type:            SHT_PROGBITS
     Flags:           [ SHF_GNU_RETAIN ]
     AddressAlign:    0x8
-    Content:         
83AD05A5F1438E681E01000052D33558163C11044C551E9517F40F4F01010101052C0111150E02030113001A2005010013001A05001C001F05002000A1808080080500210B04050109000E2009350009000E09000F009080808008090010020609010B000C200D39000B000C0D000D008E808080080D000E0010350106008C8080800835000C0406350010001520113D00100015110016009780808008110017020611010B000C201541000B000C15000D008E8080800815000E00103D0106008C808080083D000C02063D010B000C201945000B000C19000D008E8080800819000E00101002010062050109000F050009000A21000A008E8080800821000E000F1D00100091808080081D00110013050109000F050009000A2D000A008E808080082D000E000F29001000918080800829001100131002010001
+    Content:         
83AD05A5F1438E683A01000052D33558163C11044C551E9517F40F4F0101010105300111150E02030113001A2005010013001A05001C001F05002000A1808080080500210B04050109000E2009350009000E09000F009080808008090010020609010B000C200D39000B000C0D000D008E808080080D000E0010350106008C8080800835000C0406350010001520113D00100015110016009780808008110017020611010B000C201541000B000C15000D008E8080800815000E00103D0106008C808080083D000C02063D010B000C201945000B000C19000D008E8080800819000E00101002010062050109000F050009000A2021000009000A21000A008E8080800821000E000F202551000E000F1D00100091808080081D00110013050109000F050009000A20002D0009000A2D000A008E808080082D000E000F205D31000E000F29001000918080800829001100131002010001
   - Name:            '__llvm_covfun (2)'
     Type:            SHT_PROGBITS
     Flags:           [ SHF_GNU_RETAIN ]
@@ -41,12 +41,12 @@ Sections:
     Type:            SHT_PROGBITS
     Flags:           [ SHF_GNU_RETAIN ]
     AddressAlign:    0x8
-    Content:         
59A48AA8899AA358B100000091E33C8FF36C04004C551E9517F40F4F01010101051C01B4011A0C02030213001A2005010013001A05001C001F05002000A1808080080500210804050109000E09000E00928080800809001200131001010064050109000E11000E009280808008110012001310010100640501090017050009000E21000E0092808080082100120017190017009B8080800819001B001C10010100710501090017050009000E31000E0092808080083100120017290017009B8080800829001B001C1002010071
+    Content:         
59A48AA8899AA358F700000091E33C8FF36C04004C551E9517F40F4F01010101052601B4011A0C02030213001A2005010013001A05001C001F05002000A1808080080500210804050109000E2039090009000E09000E0092808080080900120013203D0D001200131001010064050109000E2011410009000E11000E00928080800811001200132015450012001310010100640501090017050009000E2049210009000E21000E0092808080082100120017204D2500120017190017009B8080800819001B001C20551D001B001C10010100710501090017050009000E2031590009000E31000E009280808008310012001720355D00120017290017009B8080800829001B001C202D65001B001C1002010071
   - Name:            '__llvm_covfun (7)'
     Type:            SHT_PROGBITS
     Flags:           [ SHF_GNU_RETAIN ]
     AddressAlign:    0x8
-    Content:         
F5953D044B505D13C10000005FD132562FE71E0C4C551E9517F40F4F010107010501110111011D011D012901291E01C201150D02100201000103010A001503000A000B09000B008F8080800809000F0015050016018580808008050105000810010100010B010A001C0B000A0011150011009580808008150015001C11001D01858080800811010500081001010001130111001C1300110012210012009680808008210016001C1D001E00211D0022002310010100681B010A001C1B000A00112D00110095808080082D0015001C29001E002129002200231001010068
+    Content:         
F5953D044B505D13F90000005FD132562FE71E0C4C551E9517F40F4F010107010501110111011D011D012901292601C201150D02100201000103010A001503000A000B200935000A000B09000B008F8080800809000F0015200D39000F0015050016018580808008050105000810010100010B010A001C0B000A0011203D15000A0011150011009580808008150015001C2041190015001C11001D01858080800811010500081001010001130111001C130011001220214500110012210012009680808008210016001C2025490016001C1D001E00211D0022002310010100681B010A001C1B000A0011204D2D000A00112D00110095808080082D0015001C2051310015001C29001E002129002200231001010068
   - Name:            '__llvm_covfun (8)'
     Type:            SHT_PROGBITS
     Flags:           [ SHF_GNU_RETAIN ]
@@ -112,7 +112,7 @@ Symbols:
     Type:            STT_OBJECT
     Section:         '__llvm_covfun (1)'
     Binding:         STB_WEAK
-    Size:            0x13A
+    Size:            0x156
     Other:           [ STV_HIDDEN ]
   - Name:            __covrec_6973C52804C74904u
     Type:            STT_OBJECT
@@ -142,13 +142,13 @@ Symbols:
     Type:            STT_OBJECT
     Section:         '__llvm_covfun (6)'
     Binding:         STB_WEAK
-    Size:            0xCD
+    Size:            0x113
     Other:           [ STV_HIDDEN ]
   - Name:            __covrec_135D504B043D95F5u
     Type:            STT_OBJECT
     Section:         '__llvm_covfun (7)'
     Binding:         STB_WEAK
-    Size:            0xDD
+    Size:            0x115
     Other:           [ STV_HIDDEN ]
   - Name:            __covrec_795CF1BD69C3E520u
     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 8ecd5eaaed5da..30810ada1ed95 100644
--- a/llvm/test/tools/llvm-cov/Inputs/branch-c-general.c
+++ b/llvm/test/tools/llvm-cov/Inputs/branch-c-general.c
@@ -23,10 +23,10 @@ void conditionals() {           // CHECK: 
@LINE|{{.*}}conditionals()
     } else {
       if (i) {}                 // CHECK: Branch ([[@LINE]]:11): [True: 
[[#min(C,16)]], False: 1]
     }
-                                // BRCOV: Branch ([[@LINE+1]]:9): [True: 
[[#min(C,100)]], Folded]
-    if (1 && i) {}              // BRCOV: Branch ([[@LINE]]:14): [True: 
[[#min(C,99)]], False: 1]
-    if (0 || i) {}              // BRCOV: Branch ([[@LINE]]:9): [Folded, 
False: [[#min(C,100)]]]
-  }                             // BRCOV: Branch ([[@LINE-1]]:14): [True: 
[[#min(C,99)]], False: 1]
+                                // CHECK: Branch ([[@LINE+1]]:9): [True: 
[[#min(C,100)]], Folded]
+    if (1 && i) {}              // CHECK: Branch ([[@LINE]]:14): [True: 
[[#min(C,99)]], False: 1]
+    if (0 || i) {}              // CHECK: Branch ([[@LINE]]:9): [Folded, 
False: [[#min(C,100)]]]
+  }                             // CHECK: Branch ([[@LINE-1]]:14): [True: 
[[#min(C,99)]], False: 1]
 
 }
 
@@ -180,30 +180,30 @@ void big_switch() {             // CHECK: 
@LINE|{{.*}}big_switch()
 void boolean_operators() {      // CHECK: @LINE|{{.*}}boolean_operators()
   int v;
   for (int i = 0; i < 100; ++i) {
-    v = i % 3 || i;             // BRCOV: Branch ([[@LINE]]:9): [True: 
[[#min(C,66)]], False: [[#min(C,34)]]]
-                                // BRCOV: Branch ([[@LINE-1]]:18): [True: 
[[#min(C,33)]], False: 1]
-    v = i % 3 && i;             // BRCOV: Branch ([[@LINE]]:9): [True: 
[[#min(C,66)]], False: [[#min(C,34)]]]
-                                // BRCOV: Branch ([[@LINE-1]]:18): [True: 
[[#min(C,66)]], False: 0]
-    v = i % 3 || i % 2 || i;    // BRCOV: Branch ([[@LINE]]:9): [True: 
[[#min(C,66)]], False: [[#min(C,34)]]]
-                                // BRCOV: Branch ([[@LINE-1]]:18): [True: 
[[#min(C,17)]], False: [[#min(C,17)]]]
-    v = i % 2 && i % 3 && i;    // BRCOV: Branch ([[@LINE-2]]:27): [True: 
[[#min(C,16)]], False: 1]
-  }                             // BRCOV: Branch ([[@LINE-1]]:9): [True: 
[[#min(C,50)]], False: [[#min(C,50)]]]
-                                // BRCOV: Branch ([[@LINE-2]]:18): [True: 
[[#min(C,33)]], False: [[#min(C,17)]]]
-}                               // BRCOV: Branch ([[@LINE-3]]:27): [True: 
[[#min(C,33)]], False: 0]
+    v = i % 3 || i;             // CHECK: Branch ([[@LINE]]:9): [True: 
[[#min(C,66)]], False: [[#min(C,34)]]]
+                                // CHECK: Branch ([[@LINE-1]]:18): [True: 
[[#min(C,33)]], False: 1]
+    v = i % 3 && i;             // CHECK: Branch ([[@LINE]]:9): [True: 
[[#min(C,66)]], False: [[#min(C,34)]]]
+                                // CHECK: Branch ([[@LINE-1]]:18): [True: 
[[#min(C,66)]], False: 0]
+    v = i % 3 || i % 2 || i;    // CHECK: Branch ([[@LINE]]:9): [True: 
[[#min(C,66)]], False: [[#min(C,34)]]]
+                                // CHECK: Branch ([[@LINE-1]]:18): [True: 
[[#min(C,17)]], False: [[#min(C,17)]]]
+    v = i % 2 && i % 3 && i;    // CHECK: Branch ([[@LINE-2]]:27): [True: 
[[#min(C,16)]], False: 1]
+  }                             // CHECK: Branch ([[@LINE-1]]:9): [True: 
[[#min(C,50)]], False: [[#min(C,50)]]]
+                                // CHECK: Branch ([[@LINE-2]]:18): [True: 
[[#min(C,33)]], False: [[#min(C,17)]]]
+}                               // CHECK: Branch ([[@LINE-3]]:27): [True: 
[[#min(C,33)]], False: 0]
 
 void boolop_loops() {           // CHECK: @LINE|{{.*}}boolop_loops()
   int i = 100;
 
-  while (i && i > 50)           // BRCOV: Branch ([[@LINE]]:10): [True: 
[[#min(C,51)]], False: 0]
-    i--;                        // BRCOV: Branch ([[@LINE-1]]:15): [True: 
[[#min(C,50)]], False: 1]
+  while (i && i > 50)           // CHECK: Branch ([[@LINE]]:10): [True: 
[[#min(C,51)]], False: 0]
+    i--;                        // CHECK: Branch ([[@LINE-1]]:15): [True: 
[[#min(C,50)]], False: 1]
 
-  while ((i % 2) || (i > 0))    // BRCOV: Branch ([[@LINE]]:10): [True: 
[[#min(C,25)]], False: [[#min(C,26)]]]
-    i--;                        // BRCOV: Branch ([[@LINE-1]]:21): [True: 
[[#min(C,25)]], False: 1]
+  while ((i % 2) || (i > 0))    // CHECK: Branch ([[@LINE]]:10): [True: 
[[#min(C,25)]], False: [[#min(C,26)]]]
+    i--;                        // CHECK: Branch ([[@LINE-1]]:21): [True: 
[[#min(C,25)]], False: 1]
 
-  for (i = 100; i && i > 50; --i);  // BRCOV: Branch ([[@LINE]]:17): [True: 
[[#min(C,51)]], False: 0]
-                                    // BRCOV: Branch ([[@LINE-1]]:22): [True: 
[[#min(C,50)]], False: 1]
-  for (; (i % 2) || (i > 0); --i);  // BRCOV: Branch ([[@LINE]]:10): [True: 
[[#min(C,25)]], False: [[#min(C,26)]]]
-                                    // BRCOV: Branch ([[@LINE-1]]:21): [True: 
[[#min(C,25)]], False: 1]
+  for (i = 100; i && i > 50; --i);  // CHECK: Branch ([[@LINE]]:17): [True: 
[[#min(C,51)]], False: 0]
+                                    // CHECK: Branch ([[@LINE-1]]:22): [True: 
[[#min(C,50)]], False: 1]
+  for (; (i % 2) || (i > 0); --i);  // CHECK: Branch ([[@LINE]]:10): [True: 
[[#min(C,25)]], False: [[#min(C,26)]]]
+                                    // CHECK: Branch ([[@LINE-1]]:21): [True: 
[[#min(C,25)]], False: 1]
 }
 
 void conditional_operator() {   // CHECK: @LINE|{{.*}}conditional_operator()

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 798e150d80a1a..7ebf85a88e869 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:
-63
+127
 # Counter Values:
 4
 0
@@ -65,6 +65,70 @@ _Z4funcii
 4
 1
 3
+1
+1
+2
+0
+2
+2
+4
+0
+4
+0
+3
+0
+3
+1
+4
+0
+4
+0
+4
+0
+1
+2
+1
+2
+1
+0
+0
+3
+1
+0
+3
+0
+1
+0
+2
+1
+1
+0
+2
+1
+1
+0
+3
+1
+2
+1
+0
+0
+3
+0
+1
+0
+0
+3
+1
+0
+1
+2
+1
+0
+1
+2
+1
+0
 4
 0
 3

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 0c36f48789a51..0fc3196210b09 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:         
F0A0ED2C305C0BB33C02000089B21C19C99E86758F2950E06FBD46E8010100610108194302100701000101010C000E01000C010E01000C020E01000C030E01000C040E25010C000E1D010C000E15010C000E0D010C000E05010C000E100101000101010C000E01000C010E01000C020E01000C030E01000C040E4D010C000E45010C000E3D010C000E35010C000E2D010C000E100101000101010C011001000C031001000C051001000C071001000C091001000D000F69010D000F65010C011065000D000F71010D000F61010C011061000D000F79010D000F5D010C01105D000D000F8101010D000F59010C011059000D000F8901010D000F55010C011055000D000F9101010D000F100101000101010C011001000C031001000C051001000C071001000C091001000D000FAD01010D000FA901010C0110A901000D000FB501010D000FA501010C0110A501000D000FBD01010D000FA101010C0110A101000D000FC501010D000F9D01010C01109D01000D000FCD01010D000F9901010C01109901000D000FD501010D000F1001010001010107000820DD01ED0100070008DD010009018580808008DD0101050016ED010017028580808008ED01020500161001010001010107000820E101F10100070008E1010009018580808008E10101050016F1010017028580808008F101020500161001010001010107000820E501F50100070008E5010009018580808008E50101050016F5010017028580808008F501020500161001010001010107000820E901F90100070008E9010009018580808008E90101050016F9010017028580808008F90102050016
+    Content:         
F0A0ED2C305C0BB36F03000089B21C19C99E86758F2950E06FBD46E801010085010108194302100701000101010C000E01000C010E01000C020E01000C030E01000C040E2025ED01000C000E25010C000E2029F101000C000E1D010C000E2021F901000C000E15010C000E20198102000C000E0D010C000E20118902000C000E05010C000E20099102000C000E100101000101010C000E01000C010E01000C020E01000C030E01000C040E2095024D000C000E4D010C000E20990251000C000E45010C000E20A10249000C000E3D010C000E20A90241000C000E35010C000E20B10239000C000E2D010C000E20B90231000C000E100101000101010C011001000C031001000C051001000C071001000C091001000D000F2069BD02000D000F69010D000F206DC102000D000F65010C011065000D000F2071C502000D000F71010D000F2075C902000D000F61010C011061000D000F2079D502000D000F79010D000F207DD902000D000F5D010C01105D000D000F208101E502000D000F8101010D000F208501E902000D000F59010C011059000D000F208901F502000D000F8901010D000F208D01F902000D000F55010C011055000D000F2091018503000D000F9101010D000F2095018903000D000F100101000101010C011001000C031001000C051001000C071001000C091001000D000F209503AD01000D000FAD01010D000F209903B101000D000FA901010C0110A901000D000F209D03B501000D000FB501010D000F20A103B901000D000FA501010C0110A501000D000F20AD03BD01000D000FBD01010D000F20B103C101000D000FA101010C0110A101000D000F20BD03C501000D000FC501010D000F20C103C901000D000F9D01010C01109D01000D000F20CD03CD01000D000FCD01010D000F20D103D101000D000F9901010C01109901000D000F20DD03D501000D000FD501010D000F20E103D901000D000F1001010001010107000820DD01ED0300070008DD010009018580808008DD0101050016ED030017028580808008ED03020500161001010001010107000820E101F10300070008E1010009018580808008E10101050016F1030017028580808008F103020500161001010001010107000820E501F50300070008E5010009018580808008E50101050016F5030017028580808008F503020500161001010001010107000820E901F90300070008E9010009018580808008E90101050016F9030017028580808008F90302050016
   - 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:            0x258
+    Size:            0x38B
     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 8e9ea404116c9..ec571ee8b52bd 100644
--- a/llvm/test/tools/llvm-cov/Inputs/branch-logical-mixed.cpp
+++ b/llvm/test/tools/llvm-cov/Inputs/branch-logical-mixed.cpp
@@ -13,45 +13,45 @@ void func(int a, int b) {
   bool b4 = a > b;
   bool b5 = a != b;
 
-  bool c = b0 &&           // BRCOV: Branch ([[@LINE]]:12): [True: 
[[#min(C,3)]], False: 1]
-           b1 &&           // BRCOV: Branch ([[@LINE]]:12): [True: 
[[#min(C,2)]], False: 1]
-           b2 &&           // BRCOV: Branch ([[@LINE]]:12): [True: 
[[#min(C,2)]], False: 0]
-           b3 &&           // BRCOV: Branch ([[@LINE]]:12): [True: 0, False: 
[[#min(C,2)]]]
-           b4 &&           // BRCOV: Branch ([[@LINE]]:12): [True: 0, False: 0]
-           b5;             // BRCOV: Branch ([[@LINE]]:12): [True: 0, False: 0]
+  bool c = b0 &&           // CHECK: Branch ([[@LINE]]:12): [True: 
[[#min(C,3)]], False: 1]
+           b1 &&           // CHECK: Branch ([[@LINE]]:12): [True: 
[[#min(C,2)]], False: 1]
+           b2 &&           // CHECK: Branch ([[@LINE]]:12): [True: 
[[#min(C,2)]], False: 0]
+           b3 &&           // CHECK: Branch ([[@LINE]]:12): [True: 0, False: 
[[#min(C,2)]]]
+           b4 &&           // CHECK: Branch ([[@LINE]]:12): [True: 0, False: 0]
+           b5;             // CHECK: Branch ([[@LINE]]:12): [True: 0, False: 0]
 
-  bool d = b0 ||           // BRCOV: Branch ([[@LINE]]:12): [True: 
[[#min(C,3)]], False: 1]
-           b1 ||           // BRCOV: Branch ([[@LINE]]:12): [True: 0, False: 1]
-           b2 ||           // BRCOV: Branch ([[@LINE]]:12): [True: 1, False: 0]
-           b3 ||           // BRCOV: Branch ([[@LINE]]:12): [True: 0, False: 0]
-           b4 ||           // BRCOV: Branch ([[@LINE]]:12): [True: 0, False: 0]
-           b5;             // BRCOV: Branch ([[@LINE]]:12): [True: 0, False: 0]
+  bool d = b0 ||           // CHECK: Branch ([[@LINE]]:12): [True: 
[[#min(C,3)]], False: 1]
+           b1 ||           // CHECK: Branch ([[@LINE]]:12): [True: 0, False: 1]
+           b2 ||           // CHECK: Branch ([[@LINE]]:12): [True: 1, False: 0]
+           b3 ||           // CHECK: Branch ([[@LINE]]:12): [True: 0, False: 0]
+           b4 ||           // CHECK: Branch ([[@LINE]]:12): [True: 0, False: 0]
+           b5;             // CHECK: Branch ([[@LINE]]:12): [True: 0, False: 0]
 
-  bool e = (b0  &&         // BRCOV: Branch ([[@LINE]]:13): [True: 
[[#min(C,3)]], False: 1]
-            b5) ||         // BRCOV: Branch ([[@LINE]]:13): [True: 1, False: 
[[#min(C,2)]]]
-           (b1  &&         // BRCOV: Branch ([[@LINE]]:13): [True: 
[[#min(C,2)]], False: 1]
-            b4) ||         // BRCOV: Branch ([[@LINE]]:13): [True: 0, False: 
[[#min(C,2)]]]
-           (b2  &&         // BRCOV: Branch ([[@LINE]]:13): [True: 
[[#min(C,3)]], False: 0]
-            b3) ||         // BRCOV: Branch ([[@LINE]]:13): [True: 0, False: 
[[#min(C,3)]]]
-           (b3  &&         // BRCOV: Branch ([[@LINE]]:13): [True: 0, False: 
[[#min(C,3)]]]
-            b2) ||         // BRCOV: Branch ([[@LINE]]:13): [True: 0, False: 0]
-           (b4  &&         // BRCOV: Branch ([[@LINE]]:13): [True: 1, False: 
[[#min(C,2)]]]
-            b1) ||         // BRCOV: Branch ([[@LINE]]:13): [True: 0, False: 1]
-           (b5  &&         // BRCOV: Branch ([[@LINE]]:13): [True: 1, False: 
[[#min(C,2)]]]
-            b0);           // BRCOV: Branch ([[@LINE]]:13): [True: 0, False: 1]
+  bool e = (b0  &&         // CHECK: Branch ([[@LINE]]:13): [True: 
[[#min(C,3)]], False: 1]
+            b5) ||         // CHECK: Branch ([[@LINE]]:13): [True: 1, False: 
[[#min(C,2)]]]
+           (b1  &&         // CHECK: Branch ([[@LINE]]:13): [True: 
[[#min(C,2)]], False: 1]
+            b4) ||         // CHECK: Branch ([[@LINE]]:13): [True: 0, False: 
[[#min(C,2)]]]
+           (b2  &&         // CHECK: Branch ([[@LINE]]:13): [True: 
[[#min(C,3)]], False: 0]
+            b3) ||         // CHECK: Branch ([[@LINE]]:13): [True: 0, False: 
[[#min(C,3)]]]
+           (b3  &&         // CHECK: Branch ([[@LINE]]:13): [True: 0, False: 
[[#min(C,3)]]]
+            b2) ||         // CHECK: Branch ([[@LINE]]:13): [True: 0, False: 0]
+           (b4  &&         // CHECK: Branch ([[@LINE]]:13): [True: 1, False: 
[[#min(C,2)]]]
+            b1) ||         // CHECK: Branch ([[@LINE]]:13): [True: 0, False: 1]
+           (b5  &&         // CHECK: Branch ([[@LINE]]:13): [True: 1, False: 
[[#min(C,2)]]]
+            b0);           // CHECK: Branch ([[@LINE]]:13): [True: 0, False: 1]
 
-  bool f = (b0  ||         // BRCOV: Branch ([[@LINE]]:13): [True: 
[[#min(C,3)]], False: 1]
-            b5) &&         // BRCOV: Branch ([[@LINE]]:13): [True: 1, False: 0]
-           (b1  ||         // BRCOV: Branch ([[@LINE]]:13): [True: 
[[#min(C,2)]], False: [[#min(C,2)]]]
-            b4) &&         // BRCOV: Branch ([[@LINE]]:13): [True: 1, False: 1]
-           (b2  ||         // BRCOV: Branch ([[@LINE]]:13): [True: 
[[#min(C,3)]], False: 0]
-            b3) &&         // BRCOV: Branch ([[@LINE]]:13): [True: 0, False: 0]
-           (b3  ||         // BRCOV: Branch ([[@LINE]]:13): [True: 0, False: 
[[#min(C,3)]]]
-            b2) &&         // BRCOV: Branch ([[@LINE]]:13): [True: 
[[#min(C,3)]], False: 0]
-           (b4  ||         // BRCOV: Branch ([[@LINE]]:13): [True: 1, False: 
[[#min(C,2)]]]
-            b1) &&         // BRCOV: Branch ([[@LINE]]:13): [True: 
[[#min(C,2)]], False: 0]
-           (b5  ||         // BRCOV: Branch ([[@LINE]]:13): [True: 1, False: 
[[#min(C,2)]]]
-            b0);           // BRCOV: Branch ([[@LINE]]:13): [True: 
[[#min(C,2)]], False: 0]
+  bool f = (b0  ||         // CHECK: Branch ([[@LINE]]:13): [True: 
[[#min(C,3)]], False: 1]
+            b5) &&         // CHECK: Branch ([[@LINE]]:13): [True: 1, False: 0]
+           (b1  ||         // CHECK: Branch ([[@LINE]]:13): [True: 
[[#min(C,2)]], False: [[#min(C,2)]]]
+            b4) &&         // CHECK: Branch ([[@LINE]]:13): [True: 1, False: 1]
+           (b2  ||         // CHECK: Branch ([[@LINE]]:13): [True: 
[[#min(C,3)]], False: 0]
+            b3) &&         // CHECK: Branch ([[@LINE]]:13): [True: 0, False: 0]
+           (b3  ||         // CHECK: Branch ([[@LINE]]:13): [True: 0, False: 
[[#min(C,3)]]]
+            b2) &&         // CHECK: Branch ([[@LINE]]:13): [True: 
[[#min(C,3)]], False: 0]
+           (b4  ||         // CHECK: Branch ([[@LINE]]:13): [True: 1, False: 
[[#min(C,2)]]]
+            b1) &&         // CHECK: Branch ([[@LINE]]:13): [True: 
[[#min(C,2)]], False: 0]
+           (b5  ||         // CHECK: Branch ([[@LINE]]:13): [True: 1, False: 
[[#min(C,2)]]]
+            b0);           // CHECK: Branch ([[@LINE]]:13): [True: 
[[#min(C,2)]], False: 0]
 
   if (c)                   // CHECK: Branch ([[@LINE]]:7): [True: 0, False: 
[[#min(C,4)]]]
     printf("case0\n");

diff  --git a/llvm/test/tools/llvm-cov/Inputs/branch-macros-single.proftext 
b/llvm/test/tools/llvm-cov/Inputs/branch-macros-single.proftext
index 29dc4ef3bf5c2..1643936583df4 100644
--- a/llvm/test/tools/llvm-cov/Inputs/branch-macros-single.proftext
+++ b/llvm/test/tools/llvm-cov/Inputs/branch-macros-single.proftext
@@ -4,7 +4,7 @@ _Z4funcii
 # Func Hash:
 456046650042366162
 # Num Counters:
-19
+37
 # Counter Values:
 3
 1
@@ -25,12 +25,30 @@ _Z4funcii
 0
 0
 0
+2
+1
+2
+1
+2
+1
+2
+1
+2
+1
+3
+0
+3
+0
+3
+0
+3
+0
 
 _Z5func2ii
 # Func Hash:
 14151920320560143107
 # Num Counters:
-9
+15
 # Counter Values:
 3
 3
@@ -40,7 +58,13 @@ _Z5func2ii
 0
 1
 0
+2
+1
 3
+2
+1
+0
+1
 
 main
 # Func Hash:

diff  --git a/llvm/test/tools/llvm-cov/Inputs/branch-macros-single.yaml 
b/llvm/test/tools/llvm-cov/Inputs/branch-macros-single.yaml
index 7545e311af7ab..2951ae89d2b8d 100644
--- a/llvm/test/tools/llvm-cov/Inputs/branch-macros-single.yaml
+++ b/llvm/test/tools/llvm-cov/Inputs/branch-macros-single.yaml
@@ -11,12 +11,12 @@ Sections:
     Type:            SHT_PROGBITS
     Flags:           [ SHF_GNU_RETAIN ]
     AddressAlign:    0x8
-    Content:         
F0A0ED2C305C0BB33F010000D238C8100334540693E696313ECE8F5D15010101010101010101010101010101010101010101001501101911020C010C0011140015001A100101005C1C010C0011100101006224010C001210010100682C010C0012100101006E34010C0012100101007401010A000B01000A001001000A001501000A001A45000F00103D00140015350019001A2D001E001F10010104550201050F001701000F00170105060F00170301070F001F3C00100015440019001E014C0910001501540A100016015C0B1000160201050F001701000F0017010D060F00170301070F001F64001000156C0019001E017409100015017C0A1000160201050F001701000F00170115060F00170301070F001F8401001000158C010019001E019401091000150201050F001701000F0017011D060F00170301070F001F9C0100100015A4010019001E0201050F001701000F00170125060F0017
+    Content:         
F0A0ED2C305C0BB3AB010000D238C8100334540693E696313ECE8F5D15010101010101010101010101010101010101010101001A01101911020C010C0011140015001A100101005C1C010C0011100101006224010C001210010100682C010C0012100101006E34010C0012100101007401010A000B01000A001001000A001501000A001A204575000A000B45000F0010204979000F00103D001400152041810100140015350019001A203989010019001A2D001E001F20319101001E001F10010104550301050F001701000F001720054D000F00170205060F0017200951000F00170301070F001F3C00100015440019001E014C0910001501540A100016015C0B1000160301050F001701000F0017200D55000F0017020D060F0017201159000F00170301070F001F64001000156C0019001E017409100015017C0A1000160301050F001701000F001720155D000F00170215060F0017201961000F00170301070F001F8401001000158C010019001E019401091000150301050F001701000F0017201D65000F0017021D060F0017202169000F00170301070F001F9C0100100015A4010019001E0301050F001701000F001720256D000F00170225060F0017202971000F0017
   - Name:            '__llvm_covfun (1)'
     Type:            SHT_PROGBITS
     Flags:           [ SHF_GNU_RETAIN ]
     AddressAlign:    0x8
-    Content:         
B01D983FC67363959E000000039B9E2C8DB865C493E696313ECE8F5D0D01010101010101010101010101000401241A07020C010E0014140018001D1001010365011C0B1000160405080F002624001000152C0018001D3400200025013C0A1000160305070F001F44001000154C0019001E0115060F00170121050F00170154091000150205050F001705000F00170119060F00170401070F001F01000F001F5C00100015640019001E0201050F001701000F0017010D060F0017
+    Content:         
B01D983FC6736395C1000000039B9E2C8DB865C493E696313ECE8F5D0D01010101010101010101010101000401241A07020C010E0014140018001D1001010365011C0B1000160505080F0026203909000F002624001000152C0018001D3400200025013C0A1000160305070F001F44001000154C0019001E0115060F00170129050F00170154091000150305050F001705000F001720192D000F00170219060F0017201D31000F00170401070F001F01000F001F5C00100015640019001E0301050F001701000F0017200D21000F0017020D060F0017201125000F0017
   - Name:            '__llvm_covfun (2)'
     Type:            SHT_PROGBITS
     Flags:           [ SHF_GNU_RETAIN ]
@@ -52,13 +52,13 @@ Symbols:
     Type:            STT_OBJECT
     Section:         __llvm_covfun
     Binding:         STB_WEAK
-    Size:            0x15B
+    Size:            0x1C7
     Other:           [ STV_HIDDEN ]
   - Name:            __covrec_956373C63F981DB0u
     Type:            STT_OBJECT
     Section:         '__llvm_covfun (1)'
     Binding:         STB_WEAK
-    Size:            0xBA
+    Size:            0xDD
     Other:           [ STV_HIDDEN ]
   - Name:            __covrec_DB956436E78DD5FAu
     Type:            STT_OBJECT

diff  --git a/llvm/test/tools/llvm-cov/Inputs/branch-macros.cpp 
b/llvm/test/tools/llvm-cov/Inputs/branch-macros.cpp
index ad627106f32bd..1534c22a926b0 100644
--- a/llvm/test/tools/llvm-cov/Inputs/branch-macros.cpp
+++ b/llvm/test/tools/llvm-cov/Inputs/branch-macros.cpp
@@ -5,7 +5,7 @@
 #define COND1 (a == b)
 #define COND2 (a != b)
 #define COND3 (COND1 && COND2)
-#define COND4 (COND3 ? COND2 : COND1) // BRCOV: | Branch ([[@LINE]]:15): 
[True: 1, False: [[#min(C,2)]]]
+#define COND4 (COND3 ? COND2 : COND1) // CHECK: | Branch ([[@LINE]]:15): 
[True: 1, False: [[#min(C,2)]]]
 #define MACRO1 COND3
 #define MACRO2 MACRO1
 #define MACRO3 MACRO2
@@ -14,31 +14,31 @@
 
 // CHECK: |{{ +}}[[#min(C,3)]]|bool func(
 bool func(int a, int b) {
-  bool c = COND1 && COND2; // BRCOV: |  |  |  Branch ([[@LINE-12]]:15): [True: 
1, False: [[#min(C,2)]]]
-                           // BRCOV: |  |  |  Branch ([[@LINE-12]]:15): [True: 
0, False: 1]
-  bool d = COND3;          // BRCOV: |  |  |  |  |  Branch ([[@LINE-14]]:15): 
[True: 1, False: [[#min(C,2)]]]
-                           // BRCOV: |  |  |  |  |  Branch ([[@LINE-14]]:15): 
[True: 0, False: 1]
-  bool e = MACRO1;         // BRCOV: |  |  |  |  |  |  |  Branch 
([[@LINE-16]]:15): [True: 1, False: [[#min(C,2)]]]
-                           // BRCOV: |  |  |  |  |  |  |  Branch 
([[@LINE-16]]:15): [True: 0, False: 1]
-  bool f = MACRO2;         // BRCOV: |  |  |  |  |  |  |  |  |  Branch 
([[@LINE-18]]:15): [True: 1, False: [[#min(C,2)]]]
-                           // BRCOV: |  |  |  |  |  |  |  |  |  Branch 
([[@LINE-18]]:15): [True: 0, False: 1]
-  bool g = MACRO3;         // BRCOV: |  |  |  |  |  |  |  |  |  |  |  Branch 
([[@LINE-20]]:15): [True: 1, False: [[#min(C,2)]]]
-                           // BRCOV: |  |  |  |  |  |  |  |  |  |  |  Branch 
([[@LINE-20]]:15): [True: 0, False: 1]
+  bool c = COND1 && COND2; // CHECK: |  |  |  Branch ([[@LINE-12]]:15): [True: 
1, False: [[#min(C,2)]]]
+                           // CHECK: |  |  |  Branch ([[@LINE-12]]:15): [True: 
0, False: 1]
+  bool d = COND3;          // CHECK: |  |  |  |  |  Branch ([[@LINE-14]]:15): 
[True: 1, False: [[#min(C,2)]]]
+                           // CHECK: |  |  |  |  |  Branch ([[@LINE-14]]:15): 
[True: 0, False: 1]
+  bool e = MACRO1;         // CHECK: |  |  |  |  |  |  |  Branch 
([[@LINE-16]]:15): [True: 1, False: [[#min(C,2)]]]
+                           // CHECK: |  |  |  |  |  |  |  Branch 
([[@LINE-16]]:15): [True: 0, False: 1]
+  bool f = MACRO2;         // CHECK: |  |  |  |  |  |  |  |  |  Branch 
([[@LINE-18]]:15): [True: 1, False: [[#min(C,2)]]]
+                           // CHECK: |  |  |  |  |  |  |  |  |  Branch 
([[@LINE-18]]:15): [True: 0, False: 1]
+  bool g = MACRO3;         // CHECK: |  |  |  |  |  |  |  |  |  |  |  Branch 
([[@LINE-20]]:15): [True: 1, False: [[#min(C,2)]]]
+                           // CHECK: |  |  |  |  |  |  |  |  |  |  |  Branch 
([[@LINE-20]]:15): [True: 0, False: 1]
   return c && d && e && f && g;
-                           // BRCOV: |  Branch ([[@LINE-1]]:10): [True: 0, 
False: [[#min(C,3)]]]
-                           // BRCOV: |  Branch ([[@LINE-2]]:15): [True: 0, 
False: 0]
-                           // BRCOV: |  Branch ([[@LINE-3]]:20): [True: 0, 
False: 0]
-                           // BRCOV: |  Branch ([[@LINE-4]]:25): [True: 0, 
False: 0]
-                           // BRCOV: |  Branch ([[@LINE-5]]:30): [True: 0, 
False: 0]
+                           // CHECK: |  Branch ([[@LINE-1]]:10): [True: 0, 
False: [[#min(C,3)]]]
+                           // CHECK: |  Branch ([[@LINE-2]]:15): [True: 0, 
False: 0]
+                           // CHECK: |  Branch ([[@LINE-3]]:20): [True: 0, 
False: 0]
+                           // CHECK: |  Branch ([[@LINE-4]]:25): [True: 0, 
False: 0]
+                           // CHECK: |  Branch ([[@LINE-5]]:30): [True: 0, 
False: 0]
 }
 
 
 bool func2(int a, int b) {
-    bool h = MACRO3 || COND4;  // BRCOV: |  |  |  |  |  |  |  |  |  |  |  
Branch ([[@LINE-32]]:15): [True: 1, False: [[#min(C,2)]]]
-                               // BRCOV: |  |  |  |  |  |  |  |  |  |  |  
Branch ([[@LINE-32]]:15): [True: 0, False: 1]
-                               // BRCOV: |  |  |  |  |  |  |  Branch 
([[@LINE-34]]:15): [True: 1, False: [[#min(C,2)]]]
-                               // BRCOV: |  |  |  |  |  |  |  Branch 
([[@LINE-34]]:15): [True: 0, False: 1]
-                               // BRCOV: |  |  |  Branch ([[@LINE-33]]:15): 
[True: 1, False: [[#min(C,2)]]]
+    bool h = MACRO3 || COND4;  // CHECK: |  |  |  |  |  |  |  |  |  |  |  
Branch ([[@LINE-32]]:15): [True: 1, False: [[#min(C,2)]]]
+                               // CHECK: |  |  |  |  |  |  |  |  |  |  |  
Branch ([[@LINE-32]]:15): [True: 0, False: 1]
+                               // CHECK: |  |  |  |  |  |  |  Branch 
([[@LINE-34]]:15): [True: 1, False: [[#min(C,2)]]]
+                               // CHECK: |  |  |  |  |  |  |  Branch 
([[@LINE-34]]:15): [True: 0, False: 1]
+                               // CHECK: |  |  |  Branch ([[@LINE-33]]:15): 
[True: 1, False: [[#min(C,2)]]]
   return h;
 }
 

diff  --git a/llvm/test/tools/llvm-cov/branch-macros.test 
b/llvm/test/tools/llvm-cov/branch-macros.test
index b16ef9d4846d8..311d6d803fd3d 100644
--- a/llvm/test/tools/llvm-cov/branch-macros.test
+++ b/llvm/test/tools/llvm-cov/branch-macros.test
@@ -1,6 +1,6 @@
 // RUN: llvm-profdata merge %S/Inputs/branch-macros.proftext -o %t.profdata
-// RUN: llvm-cov show --show-expansions --show-branches=count 
%S/Inputs/branch-macros.o32l -instr-profile %t.profdata 
-path-equivalence=/tmp,%S/Inputs | FileCheck %S/Inputs/branch-macros.cpp 
-check-prefixes=CHECK,BRCOV -D#C=999
-// RUN: llvm-cov show --binary-counters --show-expansions 
--show-branches=count %S/Inputs/branch-macros.o32l -instr-profile %t.profdata 
-path-equivalence=/tmp,%S/Inputs | FileCheck %S/Inputs/branch-macros.cpp 
-check-prefixes=CHECK,BRCOV -D#C=1
+// RUN: llvm-cov show --show-expansions --show-branches=count 
%S/Inputs/branch-macros.o32l -instr-profile %t.profdata 
-path-equivalence=/tmp,%S/Inputs | FileCheck %S/Inputs/branch-macros.cpp 
-D#C=999
+// RUN: llvm-cov show --binary-counters --show-expansions 
--show-branches=count %S/Inputs/branch-macros.o32l -instr-profile %t.profdata 
-path-equivalence=/tmp,%S/Inputs | FileCheck %S/Inputs/branch-macros.cpp -D#C=1
 // RUN: llvm-cov report --show-branch-summary %S/Inputs/branch-macros.o32l 
-instr-profile %t.profdata -show-functions -path-equivalence=/tmp,%S/Inputs 
%S/Inputs/branch-macros.cpp | FileCheck %s -check-prefix=REPORT
 
 // RUN: yaml2obj %S/Inputs/branch-macros-single.yaml -o %t.o


        
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to