From 71f8b441ed6a944ceb4530b49e8588dcbb1e0066 Mon Sep 17 00:00:00 2001 From: NAKAMURA Takumi Date: Thu, 13 Jun 2024 20:09:02 +0900 Subject: [PATCH] Reapply: [MC/DC][Coverage] Loosen the limit of NumConds from 6 (#82448) By storing possible test vectors instead of combinations of conditions, the restriction is dramatically relaxed. This introduces two options to `cc1`: * `-fmcdc-max-conditions=32767` * `-fmcdc-max-test-vectors=2147483646` This change makes coverage mapping, profraw, and profdata incompatible with Clang-18. - Bitmap semantics changed. It is incompatible with previous format. - `BitmapIdx` in `Decision` points to the end of the bitmap. - Bitmap is packed per function. - `llvm-cov` can understand `profdata` generated by `llvm-profdata-18`. RFC: https://discourse.llvm.org/t/rfc-coverage-new-algorithm-and-file-format-for-mc-dc/76798 -- Change(s) since llvmorg-19-init-14288-g7ead2d8c7e91 - Update compiler-rt/test/profile/ContinuousSyncMode/image-with-mcdc.c --- clang/docs/SourceBasedCodeCoverage.rst | 29 ++++- clang/include/clang/Basic/CodeGenOptions.def | 2 + clang/include/clang/Driver/Options.td | 8 ++ clang/lib/CodeGen/CodeGenPGO.cpp | 50 +++++---- clang/lib/CodeGen/CoverageMappingGen.cpp | 77 ++++++++++++- clang/lib/CodeGen/MCDCState.h | 4 +- .../CoverageMapping/branch-constfolded.cpp | 34 +++--- clang/test/CoverageMapping/logical.cpp | 8 +- clang/test/CoverageMapping/mcdc-class.cpp | 4 +- .../CoverageMapping/mcdc-error-conditions.cpp | 105 +++++++++++++++++- .../mcdc-logical-scalar-ids.cpp | 30 ++--- .../mcdc-logical-stmt-ids-all.cpp | 32 +++--- .../CoverageMapping/mcdc-logical-stmt-ids.cpp | 30 ++--- .../test/CoverageMapping/mcdc-scratch-space.c | 12 +- .../CoverageMapping/mcdc-system-headers.cpp | 8 +- clang/test/Profile/c-mcdc-class.cpp | 38 ++++--- clang/test/Profile/c-mcdc-logicalop-ternary.c | 18 +-- clang/test/Profile/c-mcdc-nested-ternary.c | 35 +++--- clang/test/Profile/c-mcdc-not.c | 53 ++++----- clang/test/Profile/c-mcdc.c | 63 +++++------ .../ContinuousSyncMode/image-with-mcdc.c | 2 +- llvm/docs/CoverageMappingFormat.rst | 2 +- llvm/docs/LangRef.rst | 18 ++- llvm/include/llvm/IR/IntrinsicInst.h | 11 +- .../ProfileData/Coverage/CoverageMapping.h | 3 +- llvm/include/llvm/ProfileData/InstrProf.h | 2 +- .../ProfileData/Coverage/CoverageMapping.cpp | 34 ++++-- .../Instrumentation/InstrProfiling.cpp | 15 ++- .../InstrProfiling/inline-data-var-create.ll | 6 +- .../Instrumentation/InstrProfiling/mcdc.ll | 3 +- .../llvm-cov/Inputs/mcdc-const-folding.o | Bin 34504 -> 34528 bytes .../Inputs/mcdc-const-folding.proftext | 36 +++--- llvm/test/tools/llvm-cov/Inputs/mcdc-const.o | Bin 5208 -> 5208 bytes .../tools/llvm-cov/Inputs/mcdc-const.proftext | 6 +- .../tools/llvm-cov/Inputs/mcdc-general-18.o | Bin 0 -> 6456 bytes .../llvm-cov/Inputs/mcdc-general-18.profdata | Bin 0 -> 888 bytes .../test/tools/llvm-cov/Inputs/mcdc-general.o | Bin 6456 -> 6544 bytes .../llvm-cov/Inputs/mcdc-general.proftext | 11 +- llvm/test/tools/llvm-cov/Inputs/mcdc-macro.o | Bin 6480 -> 6408 bytes .../tools/llvm-cov/Inputs/mcdc-macro.proftext | 15 +-- llvm/test/tools/llvm-cov/Inputs/mcdc-maxbs.o | Bin 4112 -> 4112 bytes llvm/test/tools/llvm-cov/mcdc-general-18.test | 20 ++++ .../ProfileData/CoverageMappingTest.cpp | 4 +- 43 files changed, 530 insertions(+), 298 deletions(-) create mode 100644 llvm/test/tools/llvm-cov/Inputs/mcdc-general-18.o create mode 100644 llvm/test/tools/llvm-cov/Inputs/mcdc-general-18.profdata create mode 100644 llvm/test/tools/llvm-cov/mcdc-general-18.test diff --git a/clang/docs/SourceBasedCodeCoverage.rst b/clang/docs/SourceBasedCodeCoverage.rst index cee706289284d..73910e134a589 100644 --- a/clang/docs/SourceBasedCodeCoverage.rst +++ b/clang/docs/SourceBasedCodeCoverage.rst @@ -484,10 +484,31 @@ MC/DC Instrumentation --------------------- When instrumenting for Modified Condition/Decision Coverage (MC/DC) using the -clang option ``-fcoverage-mcdc``, users are limited to at most **six** leaf-level -conditions in a boolean expression. A warning will be generated for boolean -expressions that contain more than six, and they will not be instrumented for -MC/DC. +clang option ``-fcoverage-mcdc``, there are two hard limits. + +The maximum number of terms is limited to 32767, which is practical for +handwritten expressions. To be more restrictive in order to enforce coding rules, +use ``-Xclang -fmcdc-max-conditions=n``. Expressions with exceeded condition +counts ``n`` will generate warnings and will be excluded in the MC/DC coverage. + +The number of test vectors (the maximum number of possible combinations of +expressions) is limited to 2,147,483,646. In this case, approximately +256MiB (==2GiB/8) is used to record test vectors. + +To reduce memory usage, users can limit the maximum number of test vectors per +expression with ``-Xclang -fmcdc-max-test-vectors=m``. +If the number of test vectors resulting from the analysis of an expression +exceeds ``m``, a warning will be issued and the expression will be excluded +from the MC/DC coverage. + +The number of test vectors ``m``, for ``n`` terms in an expression, can be +``m <= 2^n`` in the theoretical worst case, but is usually much smaller. +In simple cases, such as expressions consisting of a sequence of single +operators, ``m == n+1``. For example, ``(a && b && c && d && e && f && g)`` +requires 8 test vectors. + +Expressions such as ``((a0 && b0) || (a1 && b1) || ...)`` can cause the +number of test vectors to increase exponentially. Also, if a boolean expression is embedded in the nest of another boolean expression but separated by a non-logical operator, this is also not supported. diff --git a/clang/include/clang/Basic/CodeGenOptions.def b/clang/include/clang/Basic/CodeGenOptions.def index 7ffc40a00504f..e3f6da4a84f69 100644 --- a/clang/include/clang/Basic/CodeGenOptions.def +++ b/clang/include/clang/Basic/CodeGenOptions.def @@ -223,6 +223,8 @@ CODEGENOPT(CoverageMapping , 1, 0) ///< Generate coverage mapping regions to CODEGENOPT(DumpCoverageMapping , 1, 0) ///< Dump the generated coverage mapping ///< regions. CODEGENOPT(MCDCCoverage , 1, 0) ///< Enable MC/DC code coverage criteria. +VALUE_CODEGENOPT(MCDCMaxConds, 16, 32767) ///< MC/DC Maximum conditions. +VALUE_CODEGENOPT(MCDCMaxTVs, 32, 0x7FFFFFFE) ///< MC/DC Maximum test vectors. /// If -fpcc-struct-return or -freg-struct-return is specified. ENUM_CODEGENOPT(StructReturnConvention, StructReturnConventionKind, 2, SRCK_Default) diff --git a/clang/include/clang/Driver/Options.td b/clang/include/clang/Driver/Options.td index 1cb03ac1bffb6..4ab8638175dd3 100644 --- a/clang/include/clang/Driver/Options.td +++ b/clang/include/clang/Driver/Options.td @@ -1790,6 +1790,14 @@ defm mcdc_coverage : BoolFOption<"coverage-mcdc", "Enable MC/DC criteria when generating code coverage">, NegFlag, BothFlags<[], [ClangOption, CLOption]>>; +def fmcdc_max_conditions_EQ : Joined<["-"], "fmcdc-max-conditions=">, + Group, Visibility<[CC1Option]>, + HelpText<"Maximum number of conditions in MC/DC coverage">, + MarshallingInfoInt, "32767">; +def fmcdc_max_test_vectors_EQ : Joined<["-"], "fmcdc-max-test-vectors=">, + Group, Visibility<[CC1Option]>, + HelpText<"Maximum number of test vectors in MC/DC coverage">, + MarshallingInfoInt, "0x7FFFFFFE">; def fprofile_generate : Flag<["-"], "fprofile-generate">, Group, Visibility<[ClangOption, CLOption]>, HelpText<"Generate instrumented code to collect execution counts into default.profraw (overridden by LLVM_PROFILE_FILE env var)">; diff --git a/clang/lib/CodeGen/CodeGenPGO.cpp b/clang/lib/CodeGen/CodeGenPGO.cpp index db8e6f55302ad..59139e342de88 100644 --- a/clang/lib/CodeGen/CodeGenPGO.cpp +++ b/clang/lib/CodeGen/CodeGenPGO.cpp @@ -167,8 +167,6 @@ struct MapRegionCounters : public RecursiveASTVisitor { PGOHash Hash; /// The map of statements to counters. llvm::DenseMap &CounterMap; - /// The next bitmap byte index to assign. - unsigned NextMCDCBitmapIdx; /// The state of MC/DC Coverage in this function. MCDC::State &MCDCState; /// Maximum number of supported MC/DC conditions in a boolean expression. @@ -183,7 +181,7 @@ struct MapRegionCounters : public RecursiveASTVisitor { MCDC::State &MCDCState, unsigned MCDCMaxCond, DiagnosticsEngine &Diag) : NextCounter(0), Hash(HashVersion), CounterMap(CounterMap), - NextMCDCBitmapIdx(0), MCDCState(MCDCState), MCDCMaxCond(MCDCMaxCond), + MCDCState(MCDCState), MCDCMaxCond(MCDCMaxCond), ProfileVersion(ProfileVersion), Diag(Diag) {} // Blocks and lambdas are handled as separate functions, so we need not @@ -314,11 +312,8 @@ struct MapRegionCounters : public RecursiveASTVisitor { return true; } - // Otherwise, allocate the number of bytes required for the bitmap - // based on the number of conditions. Must be at least 1-byte long. - MCDCState.DecisionByStmt[BinOp].BitmapIdx = NextMCDCBitmapIdx; - unsigned SizeInBits = std::max(1L << NumCond, CHAR_BIT); - NextMCDCBitmapIdx += SizeInBits / CHAR_BIT; + // Otherwise, allocate the Decision. + MCDCState.DecisionByStmt[BinOp].BitmapIdx = 0; } return true; } @@ -1083,7 +1078,9 @@ void CodeGenPGO::mapRegionCounters(const Decl *D) { // for most embedded applications. Setting a maximum value prevents the // bitmap footprint from growing too large without the user's knowledge. In // the future, this value could be adjusted with a command-line option. - unsigned MCDCMaxConditions = (CGM.getCodeGenOpts().MCDCCoverage) ? 6 : 0; + unsigned MCDCMaxConditions = + (CGM.getCodeGenOpts().MCDCCoverage ? CGM.getCodeGenOpts().MCDCMaxConds + : 0); RegionCounterMap.reset(new llvm::DenseMap); RegionMCDCState.reset(new MCDC::State); @@ -1099,7 +1096,6 @@ void CodeGenPGO::mapRegionCounters(const Decl *D) { Walker.TraverseDecl(const_cast(CD)); assert(Walker.NextCounter > 0 && "no entry counter mapped for decl"); NumRegionCounters = Walker.NextCounter; - RegionMCDCState->BitmapBytes = Walker.NextMCDCBitmapIdx; FunctionHash = Walker.Hash.finalize(); } @@ -1232,7 +1228,7 @@ void CodeGenPGO::emitMCDCParameters(CGBuilderTy &Builder) { // anything. llvm::Value *Args[3] = {llvm::ConstantExpr::getBitCast(FuncNameVar, I8PtrTy), Builder.getInt64(FunctionHash), - Builder.getInt32(RegionMCDCState->BitmapBytes)}; + Builder.getInt32(RegionMCDCState->BitmapBits)}; Builder.CreateCall( CGM.getIntrinsic(llvm::Intrinsic::instrprof_mcdc_parameters), Args); } @@ -1250,6 +1246,11 @@ void CodeGenPGO::emitMCDCTestVectorBitmapUpdate(CGBuilderTy &Builder, if (DecisionStateIter == RegionMCDCState->DecisionByStmt.end()) return; + // Don't create tvbitmap_update if the record is allocated but excluded. + // Or `bitmap |= (1 << 0)` would be wrongly executed to the next bitmap. + if (DecisionStateIter->second.Indices.size() == 0) + return; + // Extract the offset of the global bitmap associated with this expression. unsigned MCDCTestVectorBitmapOffset = DecisionStateIter->second.BitmapIdx; auto *I8PtrTy = llvm::PointerType::getUnqual(CGM.getLLVMContext()); @@ -1261,7 +1262,7 @@ void CodeGenPGO::emitMCDCTestVectorBitmapUpdate(CGBuilderTy &Builder, // index represents an executed test vector. llvm::Value *Args[5] = {llvm::ConstantExpr::getBitCast(FuncNameVar, I8PtrTy), Builder.getInt64(FunctionHash), - Builder.getInt32(RegionMCDCState->BitmapBytes), + Builder.getInt32(0), // Unused Builder.getInt32(MCDCTestVectorBitmapOffset), MCDCCondBitmapAddr.emitRawPointer(CGF)}; Builder.CreateCall( @@ -1305,19 +1306,22 @@ void CodeGenPGO::emitMCDCCondBitmapUpdate(CGBuilderTy &Builder, const Expr *S, // Extract the ID of the condition we are setting in the bitmap. const auto &Branch = BranchStateIter->second; assert(Branch.ID >= 0 && "Condition has no ID!"); + assert(Branch.DecisionStmt); - auto *I8PtrTy = llvm::PointerType::getUnqual(CGM.getLLVMContext()); + // Cancel the emission if the Decision is erased after the allocation. + const auto DecisionIter = + RegionMCDCState->DecisionByStmt.find(Branch.DecisionStmt); + if (DecisionIter == RegionMCDCState->DecisionByStmt.end()) + return; - // Emit intrinsic that updates a dedicated temporary value on the stack after - // a condition is evaluated. After the set of conditions has been updated, - // the resulting value is used to update the boolean expression's bitmap. - llvm::Value *Args[5] = {llvm::ConstantExpr::getBitCast(FuncNameVar, I8PtrTy), - Builder.getInt64(FunctionHash), - Builder.getInt32(Branch.ID), - MCDCCondBitmapAddr.emitRawPointer(CGF), Val}; - Builder.CreateCall( - CGM.getIntrinsic(llvm::Intrinsic::instrprof_mcdc_condbitmap_update), - Args); + const auto &TVIdxs = DecisionIter->second.Indices[Branch.ID]; + + auto *CurTV = Builder.CreateLoad(MCDCCondBitmapAddr, + "mcdc." + Twine(Branch.ID + 1) + ".cur"); + auto *NewTV = Builder.CreateAdd(CurTV, Builder.getInt32(TVIdxs[true])); + NewTV = Builder.CreateSelect( + Val, NewTV, Builder.CreateAdd(CurTV, Builder.getInt32(TVIdxs[false]))); + Builder.CreateStore(NewTV, MCDCCondBitmapAddr); } void CodeGenPGO::setValueProfilingFlag(llvm::Module &M) { diff --git a/clang/lib/CodeGen/CoverageMappingGen.cpp b/clang/lib/CodeGen/CoverageMappingGen.cpp index 6ce2d32dd292e..ba483d857d5f4 100644 --- a/clang/lib/CodeGen/CoverageMappingGen.cpp +++ b/clang/lib/CodeGen/CoverageMappingGen.cpp @@ -195,6 +195,10 @@ class SourceMappingRegion { return std::holds_alternative(MCDCParams); } + const auto &getMCDCBranchParams() const { + return mcdc::getParams(MCDCParams); + } + bool isMCDCDecision() const { return std::holds_alternative(MCDCParams); } @@ -204,6 +208,8 @@ class SourceMappingRegion { } const mcdc::Parameters &getMCDCParams() const { return MCDCParams; } + + void resetMCDCParams() { MCDCParams = mcdc::Parameters(); } }; /// Spelling locations for the start and end of a source region. @@ -748,6 +754,7 @@ struct MCDCCoverageBuilder { llvm::SmallVector DecisionStack; MCDC::State &MCDCState; + const Stmt *DecisionStmt = nullptr; mcdc::ConditionID NextID = 0; bool NotMapped = false; @@ -777,7 +784,8 @@ struct MCDCCoverageBuilder { /// Set the given condition's ID. void setCondID(const Expr *Cond, mcdc::ConditionID ID) { - MCDCState.BranchByStmt[CodeGenFunction::stripCond(Cond)].ID = ID; + MCDCState.BranchByStmt[CodeGenFunction::stripCond(Cond)] = {ID, + DecisionStmt}; } /// Return the ID of a given condition. @@ -808,6 +816,11 @@ struct MCDCCoverageBuilder { if (NotMapped) return; + if (NextID == 0) { + DecisionStmt = E; + assert(MCDCState.DecisionByStmt.contains(E)); + } + const mcdc::ConditionIDs &ParentDecision = DecisionStack.back(); // If the operator itself has an assigned ID, this means it represents a @@ -2122,13 +2135,41 @@ struct CounterCoverageMappingBuilder subtractCounters(ParentCount, TrueCount)); } - void createDecision(const BinaryOperator *E) { + void createOrCancelDecision(const BinaryOperator *E, unsigned Since) { unsigned NumConds = MCDCBuilder.getTotalConditionsAndReset(E); if (NumConds == 0) return; + // Extract [ID, Conds] to construct the graph. + llvm::SmallVector CondIDs(NumConds); + for (const auto &SR : ArrayRef(SourceRegions).slice(Since)) { + if (SR.isMCDCBranch()) { + auto [ID, Conds] = SR.getMCDCBranchParams(); + CondIDs[ID] = Conds; + } + } + + // Construct the graph and calculate `Indices`. + mcdc::TVIdxBuilder Builder(CondIDs); + unsigned NumTVs = Builder.NumTestVectors; + unsigned MaxTVs = CVM.getCodeGenModule().getCodeGenOpts().MCDCMaxTVs; + assert(MaxTVs < mcdc::TVIdxBuilder::HardMaxTVs); + + if (NumTVs > MaxTVs) { + // NumTVs exceeds MaxTVs -- warn and cancel the Decision. + cancelDecision(E, Since, NumTVs, MaxTVs); + return; + } + + // Update the state for CodeGenPGO + assert(MCDCState.DecisionByStmt.contains(E)); + MCDCState.DecisionByStmt[E] = { + MCDCState.BitmapBits, // Top + std::move(Builder.Indices), + }; + auto DecisionParams = mcdc::DecisionParameters{ - MCDCState.DecisionByStmt[E].BitmapIdx, + MCDCState.BitmapBits += NumTVs, // Tail NumConds, }; @@ -2136,6 +2177,28 @@ struct CounterCoverageMappingBuilder createDecisionRegion(E, DecisionParams); } + // Warn and cancel the Decision. + void cancelDecision(const BinaryOperator *E, unsigned Since, int NumTVs, + int MaxTVs) { + auto &Diag = CVM.getCodeGenModule().getDiags(); + unsigned DiagID = + Diag.getCustomDiagID(DiagnosticsEngine::Warning, + "unsupported MC/DC boolean expression; " + "number of test vectors (%0) exceeds max (%1). " + "Expression will not be covered"); + Diag.Report(E->getBeginLoc(), DiagID) << NumTVs << MaxTVs; + + // Restore MCDCBranch to Branch. + for (auto &SR : MutableArrayRef(SourceRegions).slice(Since)) { + assert(!SR.isMCDCDecision() && "Decision shouldn't be seen here"); + if (SR.isMCDCBranch()) + SR.resetMCDCParams(); + } + + // Tell CodeGenPGO not to instrument. + MCDCState.DecisionByStmt.erase(E); + } + /// Check if E belongs to system headers. bool isExprInSystemHeader(const BinaryOperator *E) const { return (!SystemHeadersCoverage && @@ -2152,6 +2215,8 @@ struct CounterCoverageMappingBuilder bool IsRootNode = MCDCBuilder.isIdle(); + unsigned SourceRegionsSince = SourceRegions.size(); + // Keep track of Binary Operator and assign MCDC condition IDs. MCDCBuilder.pushAndAssignIDs(E); @@ -2190,7 +2255,7 @@ struct CounterCoverageMappingBuilder // Create MCDC Decision Region if at top-level (root). if (IsRootNode) - createDecision(E); + createOrCancelDecision(E, SourceRegionsSince); } // Determine whether the right side of OR operation need to be visited. @@ -2211,6 +2276,8 @@ struct CounterCoverageMappingBuilder bool IsRootNode = MCDCBuilder.isIdle(); + unsigned SourceRegionsSince = SourceRegions.size(); + // Keep track of Binary Operator and assign MCDC condition IDs. MCDCBuilder.pushAndAssignIDs(E); @@ -2253,7 +2320,7 @@ struct CounterCoverageMappingBuilder // Create MCDC Decision Region if at top-level (root). if (IsRootNode) - createDecision(E); + createOrCancelDecision(E, SourceRegionsSince); } void VisitLambdaExpr(const LambdaExpr *LE) { diff --git a/clang/lib/CodeGen/MCDCState.h b/clang/lib/CodeGen/MCDCState.h index 29b6f0fb681aa..e0dd28ff90ed1 100644 --- a/clang/lib/CodeGen/MCDCState.h +++ b/clang/lib/CodeGen/MCDCState.h @@ -27,16 +27,18 @@ using namespace llvm::coverage::mcdc; /// Per-Function MC/DC state struct State { - unsigned BitmapBytes = 0; + unsigned BitmapBits = 0; struct Decision { unsigned BitmapIdx; + llvm::SmallVector> Indices; }; llvm::DenseMap DecisionByStmt; struct Branch { ConditionID ID; + const Stmt *DecisionStmt; }; llvm::DenseMap BranchByStmt; diff --git a/clang/test/CoverageMapping/branch-constfolded.cpp b/clang/test/CoverageMapping/branch-constfolded.cpp index c8755d5d752b6..1e7e32808e838 100644 --- a/clang/test/CoverageMapping/branch-constfolded.cpp +++ b/clang/test/CoverageMapping/branch-constfolded.cpp @@ -4,93 +4,93 @@ // RUN: %clang_cc1 -triple %itanium_abi_triple -std=c++11 -fcoverage-mcdc -fprofile-instrument=clang -fcoverage-mapping -dump-coverage-mapping -emit-llvm-only -main-file-name branch-constfolded.cpp %s | FileCheck %s -check-prefix=MCDC // CHECK-LABEL: _Z6fand_0b: -bool fand_0(bool a) { // MCDC: Decision,File 0, [[@LINE+1]]:10 -> [[@LINE+1]]:20 = M:0, C:2 +bool fand_0(bool a) { // MCDC: Decision,File 0, [[@LINE+1]]:10 -> [[@LINE+1]]:20 = M:3, C:2 return false && a; // CHECK: Branch,File 0, [[@LINE]]:10 -> [[@LINE]]:15 = 0, 0 } // CHECK: Branch,File 0, [[@LINE-1]]:19 -> [[@LINE-1]]:20 = #2, (#1 - #2) // CHECK-LABEL: _Z6fand_1b: -bool fand_1(bool a) { // MCDC: Decision,File 0, [[@LINE+1]]:10 -> [[@LINE+1]]:19 = M:0, C:2 +bool fand_1(bool a) { // MCDC: Decision,File 0, [[@LINE+1]]:10 -> [[@LINE+1]]:19 = M:3, C:2 return a && true; // CHECK: Branch,File 0, [[@LINE]]:10 -> [[@LINE]]:11 = #1, (#0 - #1) } // CHECK: Branch,File 0, [[@LINE-1]]:15 -> [[@LINE-1]]:19 = 0, 0 // CHECK-LABEL: _Z6fand_2bb: -bool fand_2(bool a, bool b) {// MCDC: Decision,File 0, [[@LINE+1]]:10 -> [[@LINE+1]]:25 = M:0, C:3 +bool fand_2(bool a, bool b) {// MCDC: Decision,File 0, [[@LINE+1]]:10 -> [[@LINE+1]]:25 = M:4, C:3 return false && a && b; // CHECK: Branch,File 0, [[@LINE]]:10 -> [[@LINE]]:15 = 0, 0 } // CHECK: Branch,File 0, [[@LINE-1]]:19 -> [[@LINE-1]]:20 = #4, (#3 - #4) // CHECK: Branch,File 0, [[@LINE-2]]:24 -> [[@LINE-2]]:25 = #2, (#1 - #2) // CHECK-LABEL: _Z6fand_3bb: -bool fand_3(bool a, bool b) {// MCDC: Decision,File 0, [[@LINE+1]]:10 -> [[@LINE+1]]:24 = M:0, C:3 +bool fand_3(bool a, bool b) {// MCDC: Decision,File 0, [[@LINE+1]]:10 -> [[@LINE+1]]:24 = M:4, C:3 return a && true && b; // CHECK: Branch,File 0, [[@LINE]]:10 -> [[@LINE]]:11 = #3, (#0 - #3) } // CHECK: Branch,File 0, [[@LINE-1]]:15 -> [[@LINE-1]]:19 = 0, 0 // CHECK: Branch,File 0, [[@LINE-2]]:23 -> [[@LINE-2]]:24 = #2, (#1 - #2) // CHECK-LABEL: _Z6fand_4bb: -bool fand_4(bool a, bool b) {// MCDC: Decision,File 0, [[@LINE+1]]:10 -> [[@LINE+1]]:25 = M:0, C:3 +bool fand_4(bool a, bool b) {// MCDC: Decision,File 0, [[@LINE+1]]:10 -> [[@LINE+1]]:25 = M:4, C:3 return a && b && false; // CHECK: Branch,File 0, [[@LINE]]:10 -> [[@LINE]]:11 = #3, (#0 - #3) } // CHECK: Branch,File 0, [[@LINE-1]]:15 -> [[@LINE-1]]:16 = #4, (#3 - #4) // CHECK: Branch,File 0, [[@LINE-2]]:20 -> [[@LINE-2]]:25 = 0, 0 // CHECK-LABEL: _Z6fand_5b: -bool fand_5(bool a) { // MCDC: Decision,File 0, [[@LINE+1]]:10 -> [[@LINE+1]]:23 = M:0, C:2 +bool fand_5(bool a) { // MCDC: Decision,File 0, [[@LINE+1]]:10 -> [[@LINE+1]]:23 = M:3, C:2 return false && true; // CHECK: Branch,File 0, [[@LINE]]:10 -> [[@LINE]]:15 = 0, 0 } // CHECK: Branch,File 0, [[@LINE-1]]:19 -> [[@LINE-1]]:23 = 0, 0 // CHECK-LABEL: _Z6fand_6b: -bool fand_6(bool a) { // MCDC: Decision,File 0, [[@LINE+1]]:10 -> [[@LINE+1]]:19 = M:0, C:2 +bool fand_6(bool a) { // MCDC: Decision,File 0, [[@LINE+1]]:10 -> [[@LINE+1]]:19 = M:3, C:2 return true && a; // CHECK: Branch,File 0, [[@LINE]]:10 -> [[@LINE]]:14 = 0, 0 } // CHECK: Branch,File 0, [[@LINE-1]]:18 -> [[@LINE-1]]:19 = #2, (#1 - #2) // CHECK-LABEL: _Z6fand_7b: -bool fand_7(bool a) { // MCDC: Decision,File 0, [[@LINE+1]]:10 -> [[@LINE+1]]:20 = M:0, C:2 +bool fand_7(bool a) { // MCDC: Decision,File 0, [[@LINE+1]]:10 -> [[@LINE+1]]:20 = M:3, C:2 return a && false; // CHECK: Branch,File 0, [[@LINE]]:10 -> [[@LINE]]:11 = #1, (#0 - #1) } // CHECK: Branch,File 0, [[@LINE-1]]:15 -> [[@LINE-1]]:20 = 0, 0 // CHECK-LABEL: _Z5for_0b: -bool for_0(bool a) { // MCDC: Decision,File 0, [[@LINE+1]]:10 -> [[@LINE+1]]:19 = M:0, C:2 +bool for_0(bool a) { // MCDC: Decision,File 0, [[@LINE+1]]:10 -> [[@LINE+1]]:19 = M:3, C:2 return true || a; // CHECK: Branch,File 0, [[@LINE]]:10 -> [[@LINE]]:14 = 0, 0 } // CHECK: Branch,File 0, [[@LINE-1]]:18 -> [[@LINE-1]]:19 = (#1 - #2), #2 // CHECK-LABEL: _Z5for_1b: -bool for_1(bool a) { // MCDC: Decision,File 0, [[@LINE+1]]:10 -> [[@LINE+1]]:20 = M:0, C:2 +bool for_1(bool a) { // MCDC: Decision,File 0, [[@LINE+1]]:10 -> [[@LINE+1]]:20 = M:3, C:2 return a || false; // CHECK: Branch,File 0, [[@LINE]]:10 -> [[@LINE]]:11 = (#0 - #1), #1 } // CHECK: Branch,File 0, [[@LINE-1]]:15 -> [[@LINE-1]]:20 = 0, 0 // CHECK-LABEL: _Z5for_2bb: -bool for_2(bool a, bool b) {// MCDC: Decision,File 0, [[@LINE+1]]:10 -> [[@LINE+1]]:24 = M:0, C:3 +bool for_2(bool a, bool b) {// MCDC: Decision,File 0, [[@LINE+1]]:10 -> [[@LINE+1]]:24 = M:4, C:3 return true || a || b; // CHECK: Branch,File 0, [[@LINE]]:10 -> [[@LINE]]:14 = 0, 0 } // CHECK: Branch,File 0, [[@LINE-1]]:18 -> [[@LINE-1]]:19 = (#3 - #4), #4 // CHECK: Branch,File 0, [[@LINE-2]]:23 -> [[@LINE-2]]:24 = (#1 - #2), #2 // CHECK-LABEL: _Z5for_3bb: -bool for_3(bool a, bool b) {// MCDC: Decision,File 0, [[@LINE+1]]:10 -> [[@LINE+1]]:25 = M:0, C:3 +bool for_3(bool a, bool b) {// MCDC: Decision,File 0, [[@LINE+1]]:10 -> [[@LINE+1]]:25 = M:4, C:3 return a || false || b; // CHECK: Branch,File 0, [[@LINE]]:10 -> [[@LINE]]:11 = (#0 - #3), #3 } // CHECK: Branch,File 0, [[@LINE-1]]:15 -> [[@LINE-1]]:20 = 0, 0 // CHECK: Branch,File 0, [[@LINE-2]]:24 -> [[@LINE-2]]:25 = (#1 - #2), #2 // CHECK-LABEL: _Z5for_4bb: -bool for_4(bool a, bool b) {// MCDC: Decision,File 0, [[@LINE+1]]:10 -> [[@LINE+1]]:24 = M:0, C:3 +bool for_4(bool a, bool b) {// MCDC: Decision,File 0, [[@LINE+1]]:10 -> [[@LINE+1]]:24 = M:4, C:3 return a || b || true; // CHECK: Branch,File 0, [[@LINE]]:10 -> [[@LINE]]:11 = (#0 - #3), #3 } // CHECK: Branch,File 0, [[@LINE-1]]:15 -> [[@LINE-1]]:16 = (#3 - #4), #4 // CHECK: Branch,File 0, [[@LINE-2]]:20 -> [[@LINE-2]]:24 = 0, 0 // CHECK-LABEL: _Z5for_5b: -bool for_5(bool a) { // MCDC: Decision,File 0, [[@LINE+1]]:10 -> [[@LINE+1]]:23 = M:0, C:2 +bool for_5(bool a) { // MCDC: Decision,File 0, [[@LINE+1]]:10 -> [[@LINE+1]]:23 = M:3, C:2 return true || false; // CHECK: Branch,File 0, [[@LINE]]:10 -> [[@LINE]]:14 = 0, 0 } // CHECK: Branch,File 0, [[@LINE-1]]:18 -> [[@LINE-1]]:23 = 0, 0 // CHECK-LABEL: _Z5for_6b: -bool for_6(bool a) { // MCDC: Decision,File 0, [[@LINE+1]]:10 -> [[@LINE+1]]:20 = M:0, C:2 +bool for_6(bool a) { // MCDC: Decision,File 0, [[@LINE+1]]:10 -> [[@LINE+1]]:20 = M:3, C:2 return false || a; // CHECK: Branch,File 0, [[@LINE]]:10 -> [[@LINE]]:15 = 0, 0 } // CHECK: Branch,File 0, [[@LINE-1]]:19 -> [[@LINE-1]]:20 = (#1 - #2), #2 // CHECK-LABEL: _Z5for_7b: -bool for_7(bool a) { // MCDC: Decision,File 0, [[@LINE+1]]:10 -> [[@LINE+1]]:19 = M:0, C:2 +bool for_7(bool a) { // MCDC: Decision,File 0, [[@LINE+1]]:10 -> [[@LINE+1]]:19 = M:3, C:2 return a || true; // CHECK: Branch,File 0, [[@LINE]]:10 -> [[@LINE]]:11 = (#0 - #1), #1 } // CHECK: Branch,File 0, [[@LINE-1]]:15 -> [[@LINE-1]]:19 = 0, 0 // CHECK-LABEL: _Z5for_8b: -bool for_8(bool a) { // MCDC: Decision,File 0, [[@LINE+3]]:7 -> [[@LINE+3]]:20 = M:0, C:2 +bool for_8(bool a) { // MCDC: Decision,File 0, [[@LINE+3]]:7 -> [[@LINE+3]]:20 = M:3, C:2 // CHECK: Branch,File 0, [[@LINE+2]]:7 -> [[@LINE+2]]:11 = 0, 0 // CHECK: Branch,File 0, [[@LINE+1]]:15 -> [[@LINE+1]]:20 = 0, 0 if (true && false) diff --git a/clang/test/CoverageMapping/logical.cpp b/clang/test/CoverageMapping/logical.cpp index 7de59e1429808..2a22d6cca4518 100644 --- a/clang/test/CoverageMapping/logical.cpp +++ b/clang/test/CoverageMapping/logical.cpp @@ -3,22 +3,22 @@ int main() { // CHECK: File 0, [[@LINE]]:12 -> [[@LINE+23]]:2 = #0 bool bt = true; - bool bf = false; // MCDC: Decision,File 0, [[@LINE+1]]:12 -> [[@LINE+1]]:20 = M:0, C:2 + bool bf = false; // MCDC: Decision,File 0, [[@LINE+1]]:12 -> [[@LINE+1]]:20 = M:3, C:2 bool a = bt && bf; // CHECK-NEXT: File 0, [[@LINE]]:12 -> [[@LINE]]:14 = #0 // CHECK-NEXT: Branch,File 0, [[@LINE-1]]:12 -> [[@LINE-1]]:14 = #1, (#0 - #1) // CHECK-NEXT: File 0, [[@LINE-2]]:18 -> [[@LINE-2]]:20 = #1 // CHECK-NEXT: Branch,File 0, [[@LINE-3]]:18 -> [[@LINE-3]]:20 = #2, (#1 - #2) - // MCDC: Decision,File 0, [[@LINE+1]]:7 -> [[@LINE+2]]:9 = M:1, C:2 + // MCDC: Decision,File 0, [[@LINE+1]]:7 -> [[@LINE+2]]:9 = M:6, C:2 a = bt && // CHECK-NEXT: File 0, [[@LINE]]:7 -> [[@LINE]]:9 = #0 bf; // CHECK-NEXT: Branch,File 0, [[@LINE-1]]:7 -> [[@LINE-1]]:9 = #3, (#0 - #3) // CHECK-NEXT: File 0, [[@LINE-1]]:7 -> [[@LINE-1]]:9 = #3 // CHECK-NEXT: Branch,File 0, [[@LINE-2]]:7 -> [[@LINE-2]]:9 = #4, (#3 - #4) - // MCDC: Decision,File 0, [[@LINE+1]]:7 -> [[@LINE+1]]:15 = M:2, C:2 + // MCDC: Decision,File 0, [[@LINE+1]]:7 -> [[@LINE+1]]:15 = M:9, C:2 a = bf || bt; // CHECK-NEXT: File 0, [[@LINE]]:7 -> [[@LINE]]:9 = #0 // CHECK-NEXT: Branch,File 0, [[@LINE-1]]:7 -> [[@LINE-1]]:9 = (#0 - #5), #5 // CHECK-NEXT: File 0, [[@LINE-2]]:13 -> [[@LINE-2]]:15 = #5 // CHECK-NEXT: Branch,File 0, [[@LINE-3]]:13 -> [[@LINE-3]]:15 = (#5 - #6), #6 - // MCDC: Decision,File 0, [[@LINE+1]]:7 -> [[@LINE+2]]:9 = M:3, C:2 + // MCDC: Decision,File 0, [[@LINE+1]]:7 -> [[@LINE+2]]:9 = M:12, C:2 a = bf || // CHECK-NEXT: File 0, [[@LINE]]:7 -> [[@LINE]]:9 = #0 bt; // CHECK-NEXT: Branch,File 0, [[@LINE-1]]:7 -> [[@LINE-1]]:9 = (#0 - #7), #7 // CHECK-NEXT: File 0, [[@LINE-1]]:7 -> [[@LINE-1]]:9 = #7 diff --git a/clang/test/CoverageMapping/mcdc-class.cpp b/clang/test/CoverageMapping/mcdc-class.cpp index dcf6123ee0fc7..7b2937830be76 100644 --- a/clang/test/CoverageMapping/mcdc-class.cpp +++ b/clang/test/CoverageMapping/mcdc-class.cpp @@ -23,9 +23,9 @@ Value::~Value(void) { bar(); } -// CHECK-LABEL: Decision,File 0, 18:7 -> 18:31 = M:0, C:2 +// CHECK-LABEL: Decision,File 0, 18:7 -> 18:31 = M:3, C:2 // CHECK-NEXT: Branch,File 0, 18:7 -> 18:17 = (#0 - #2), #2 [1,0,2] // CHECK: Branch,File 0, 18:21 -> 18:31 = (#2 - #3), #3 [2,0,0] -// CHECK-LABEL: Decision,File 0, 22:7 -> 22:31 = M:0, C:2 +// CHECK-LABEL: Decision,File 0, 22:7 -> 22:31 = M:3, C:2 // CHECK-NEXT: Branch,File 0, 22:7 -> 22:17 = (#0 - #2), #2 [1,0,2] // CHECK: Branch,File 0, 22:21 -> 22:31 = (#2 - #3), #3 [2,0,0] diff --git a/clang/test/CoverageMapping/mcdc-error-conditions.cpp b/clang/test/CoverageMapping/mcdc-error-conditions.cpp index d34ed69343479..8f5d6bd66897c 100644 --- a/clang/test/CoverageMapping/mcdc-error-conditions.cpp +++ b/clang/test/CoverageMapping/mcdc-error-conditions.cpp @@ -1,7 +1,108 @@ -// RUN: %clang_cc1 -triple %itanium_abi_triple -std=c++11 -fcoverage-mcdc -fprofile-instrument=clang -fcoverage-mapping -dump-coverage-mapping -emit-llvm-only %s 2>&1| FileCheck %s +// RUN: %clang_cc1 -triple %itanium_abi_triple -std=c++11 -fcoverage-mcdc -fprofile-instrument=clang -fcoverage-mapping -dump-coverage-mapping -emit-llvm-only %s 2>&1| FileCheck %s --check-prefixes=CHECK,COND7,TV + +// RUN: %clang_cc1 -fmcdc-max-test-vectors=8 -triple %itanium_abi_triple -std=c++11 -fcoverage-mcdc -fprofile-instrument=clang -fcoverage-mapping -dump-coverage-mapping -emit-llvm-only %s 2>&1| FileCheck %s --check-prefixes=CHECK,COND7,TV +// RUN: %clang_cc1 -fmcdc-max-test-vectors=7 -triple %itanium_abi_triple -std=c++11 -fcoverage-mcdc -fprofile-instrument=clang -fcoverage-mapping -dump-coverage-mapping -emit-llvm-only %s 2>&1| FileCheck %s --check-prefixes=CHECK,TV7,TV + +// RUN: %clang_cc1 -fmcdc-max-conditions=287 -triple %itanium_abi_triple -std=c++11 -fcoverage-mcdc -fprofile-instrument=clang -fcoverage-mapping -dump-coverage-mapping -emit-llvm-only %s 2>&1| FileCheck %s --check-prefixes=CHECK,COND7,TV +// RUN: %clang_cc1 -fmcdc-max-conditions=286 -triple %itanium_abi_triple -std=c++11 -fcoverage-mcdc -fprofile-instrument=clang -fcoverage-mapping -dump-coverage-mapping -emit-llvm-only %s 2>&1| FileCheck %s --check-prefixes=CHECK,COND7,COND +// RUN: %clang_cc1 -fmcdc-max-conditions=7 -triple %itanium_abi_triple -std=c++11 -fcoverage-mcdc -fprofile-instrument=clang -fcoverage-mapping -dump-coverage-mapping -emit-llvm-only %s 2>&1| FileCheck %s --check-prefixes=CHECK,COND7,COND +// RUN: %clang_cc1 -fmcdc-max-conditions=6 -triple %itanium_abi_triple -std=c++11 -fcoverage-mcdc -fprofile-instrument=clang -fcoverage-mapping -dump-coverage-mapping -emit-llvm-only %s 2>&1| FileCheck %s --check-prefixes=CHECK,COND6,COND bool func_conditions(bool a, bool b, bool c, bool d, bool e, bool f, bool g) { + // TV7: :[[@LINE+2]]:10: warning: unsupported MC/DC boolean expression; number of test vectors (8) exceeds max + // COND6: :[[@LINE+1]]:10: warning: unsupported MC/DC boolean expression; number of conditions (7) exceeds max return a && b && c && d && e && f && g; } -// CHECK: warning: unsupported MC/DC boolean expression; number of conditions{{.*}} exceeds max +// From clang-tidy/misc/MisleadingIdentifier.cpp +bool func_isR(unsigned CP) { + // TV: :[[@LINE+2]]:10: warning: unsupported MC/DC boolean expression; number of test vectors (2147483647) exceeds max + // COND: :[[@LINE+1]]:10: warning: unsupported MC/DC boolean expression; number of conditions (287) exceeds max + return (CP == 0x0590) || (CP == 0x05BE) || (CP == 0x05C0) || (CP == 0x05C3) || + (CP == 0x05C6) || (0x05C8 <= CP && CP <= 0x05CF) || + (0x05D0 <= CP && CP <= 0x05EA) || (0x05EB <= CP && CP <= 0x05EE) || + (0x05EF <= CP && CP <= 0x05F2) || (0x05F3 <= CP && CP <= 0x05F4) || + (0x05F5 <= CP && CP <= 0x05FF) || (0x07C0 <= CP && CP <= 0x07C9) || + (0x07CA <= CP && CP <= 0x07EA) || (0x07F4 <= CP && CP <= 0x07F5) || + (CP == 0x07FA) || (0x07FB <= CP && CP <= 0x07FC) || + (0x07FE <= CP && CP <= 0x07FF) || (0x0800 <= CP && CP <= 0x0815) || + (CP == 0x081A) || (CP == 0x0824) || (CP == 0x0828) || + (0x082E <= CP && CP <= 0x082F) || (0x0830 <= CP && CP <= 0x083E) || + (CP == 0x083F) || (0x0840 <= CP && CP <= 0x0858) || + (0x085C <= CP && CP <= 0x085D) || (CP == 0x085E) || (CP == 0x085F) || + (CP == 0x200F) || (CP == 0xFB1D) || (0xFB1F <= CP && CP <= 0xFB28) || + (0xFB2A <= CP && CP <= 0xFB36) || (CP == 0xFB37) || + (0xFB38 <= CP && CP <= 0xFB3C) || (CP == 0xFB3D) || (CP == 0xFB3E) || + (CP == 0xFB3F) || (0xFB40 <= CP && CP <= 0xFB41) || (CP == 0xFB42) || + (0xFB43 <= CP && CP <= 0xFB44) || (CP == 0xFB45) || + (0xFB46 <= CP && CP <= 0xFB4F) || (0x10800 <= CP && CP <= 0x10805) || + (0x10806 <= CP && CP <= 0x10807) || (CP == 0x10808) || + (CP == 0x10809) || (0x1080A <= CP && CP <= 0x10835) || + (CP == 0x10836) || (0x10837 <= CP && CP <= 0x10838) || + (0x10839 <= CP && CP <= 0x1083B) || (CP == 0x1083C) || + (0x1083D <= CP && CP <= 0x1083E) || (0x1083F <= CP && CP <= 0x10855) || + (CP == 0x10856) || (CP == 0x10857) || + (0x10858 <= CP && CP <= 0x1085F) || (0x10860 <= CP && CP <= 0x10876) || + (0x10877 <= CP && CP <= 0x10878) || (0x10879 <= CP && CP <= 0x1087F) || + (0x10880 <= CP && CP <= 0x1089E) || (0x1089F <= CP && CP <= 0x108A6) || + (0x108A7 <= CP && CP <= 0x108AF) || (0x108B0 <= CP && CP <= 0x108DF) || + (0x108E0 <= CP && CP <= 0x108F2) || (CP == 0x108F3) || + (0x108F4 <= CP && CP <= 0x108F5) || (0x108F6 <= CP && CP <= 0x108FA) || + (0x108FB <= CP && CP <= 0x108FF) || (0x10900 <= CP && CP <= 0x10915) || + (0x10916 <= CP && CP <= 0x1091B) || (0x1091C <= CP && CP <= 0x1091E) || + (0x10920 <= CP && CP <= 0x10939) || (0x1093A <= CP && CP <= 0x1093E) || + (CP == 0x1093F) || (0x10940 <= CP && CP <= 0x1097F) || + (0x10980 <= CP && CP <= 0x109B7) || (0x109B8 <= CP && CP <= 0x109BB) || + (0x109BC <= CP && CP <= 0x109BD) || (0x109BE <= CP && CP <= 0x109BF) || + (0x109C0 <= CP && CP <= 0x109CF) || (0x109D0 <= CP && CP <= 0x109D1) || + (0x109D2 <= CP && CP <= 0x109FF) || (CP == 0x10A00) || + (CP == 0x10A04) || (0x10A07 <= CP && CP <= 0x10A0B) || + (0x10A10 <= CP && CP <= 0x10A13) || (CP == 0x10A14) || + (0x10A15 <= CP && CP <= 0x10A17) || (CP == 0x10A18) || + (0x10A19 <= CP && CP <= 0x10A35) || (0x10A36 <= CP && CP <= 0x10A37) || + (0x10A3B <= CP && CP <= 0x10A3E) || (0x10A40 <= CP && CP <= 0x10A48) || + (0x10A49 <= CP && CP <= 0x10A4F) || (0x10A50 <= CP && CP <= 0x10A58) || + (0x10A59 <= CP && CP <= 0x10A5F) || (0x10A60 <= CP && CP <= 0x10A7C) || + (0x10A7D <= CP && CP <= 0x10A7E) || (CP == 0x10A7F) || + (0x10A80 <= CP && CP <= 0x10A9C) || (0x10A9D <= CP && CP <= 0x10A9F) || + (0x10AA0 <= CP && CP <= 0x10ABF) || (0x10AC0 <= CP && CP <= 0x10AC7) || + (CP == 0x10AC8) || (0x10AC9 <= CP && CP <= 0x10AE4) || + (0x10AE7 <= CP && CP <= 0x10AEA) || (0x10AEB <= CP && CP <= 0x10AEF) || + (0x10AF0 <= CP && CP <= 0x10AF6) || (0x10AF7 <= CP && CP <= 0x10AFF) || + (0x10B00 <= CP && CP <= 0x10B35) || (0x10B36 <= CP && CP <= 0x10B38) || + (0x10B40 <= CP && CP <= 0x10B55) || (0x10B56 <= CP && CP <= 0x10B57) || + (0x10B58 <= CP && CP <= 0x10B5F) || (0x10B60 <= CP && CP <= 0x10B72) || + (0x10B73 <= CP && CP <= 0x10B77) || (0x10B78 <= CP && CP <= 0x10B7F) || + (0x10B80 <= CP && CP <= 0x10B91) || (0x10B92 <= CP && CP <= 0x10B98) || + (0x10B99 <= CP && CP <= 0x10B9C) || (0x10B9D <= CP && CP <= 0x10BA8) || + (0x10BA9 <= CP && CP <= 0x10BAF) || (0x10BB0 <= CP && CP <= 0x10BFF) || + (0x10C00 <= CP && CP <= 0x10C48) || (0x10C49 <= CP && CP <= 0x10C7F) || + (0x10C80 <= CP && CP <= 0x10CB2) || (0x10CB3 <= CP && CP <= 0x10CBF) || + (0x10CC0 <= CP && CP <= 0x10CF2) || (0x10CF3 <= CP && CP <= 0x10CF9) || + (0x10CFA <= CP && CP <= 0x10CFF) || (0x10D40 <= CP && CP <= 0x10E5F) || + (CP == 0x10E7F) || (0x10E80 <= CP && CP <= 0x10EA9) || + (CP == 0x10EAA) || (CP == 0x10EAD) || + (0x10EAE <= CP && CP <= 0x10EAF) || (0x10EB0 <= CP && CP <= 0x10EB1) || + (0x10EB2 <= CP && CP <= 0x10EFF) || (0x10F00 <= CP && CP <= 0x10F1C) || + (0x10F1D <= CP && CP <= 0x10F26) || (CP == 0x10F27) || + (0x10F28 <= CP && CP <= 0x10F2F) || (0x10F70 <= CP && CP <= 0x10F81) || + (0x10F86 <= CP && CP <= 0x10F89) || (0x10F8A <= CP && CP <= 0x10FAF) || + (0x10FB0 <= CP && CP <= 0x10FC4) || (0x10FC5 <= CP && CP <= 0x10FCB) || + (0x10FCC <= CP && CP <= 0x10FDF) || (0x10FE0 <= CP && CP <= 0x10FF6) || + (0x10FF7 <= CP && CP <= 0x10FFF) || (0x1E800 <= CP && CP <= 0x1E8C4) || + (0x1E8C5 <= CP && CP <= 0x1E8C6) || (0x1E8C7 <= CP && CP <= 0x1E8CF) || + (0x1E8D7 <= CP && CP <= 0x1E8FF) || (0x1E900 <= CP && CP <= 0x1E943) || + (CP == 0x1E94B) || (0x1E94C <= CP && CP <= 0x1E94F) || + (0x1E950 <= CP && CP <= 0x1E959) || (0x1E95A <= CP && CP <= 0x1E95D) || + (0x1E95E <= CP && CP <= 0x1E95F) || (0x1E960 <= CP && CP <= 0x1EC6F) || + (0x1ECC0 <= CP && CP <= 0x1ECFF) || (0x1ED50 <= CP && CP <= 0x1EDFF); +} + +// CHECK: _Z15func_conditionsbbbbbbb: +// TV8-NOT: Decision, +// COND6-NOT: Decision, +// COND7: Decision,File 0, {{[0-9]+}}:10 -> {{[0-9]+}}:41 = M:8, C:7 +// CHECK: _Z8func_isRj: +// CHECK-NOT: Decision, +// CHECK-NOT: Branch,{{.*}}] +// CHECK: Branch,File 0, [[@LINE-10]]:64 -> [[@LINE-10]]:77 = diff --git a/clang/test/CoverageMapping/mcdc-logical-scalar-ids.cpp b/clang/test/CoverageMapping/mcdc-logical-scalar-ids.cpp index c820b5df5ad3a..0694f7dbc294a 100644 --- a/clang/test/CoverageMapping/mcdc-logical-scalar-ids.cpp +++ b/clang/test/CoverageMapping/mcdc-logical-scalar-ids.cpp @@ -10,25 +10,25 @@ bool func_scalar_and(bool a, bool b, bool c, bool d, bool e, bool f) { return bar(res1, res2, res3, res4, res5); } -// CHECK-LABEL: Decision,File 0, 5:17 -> 5:23 = M:0, C:2 +// CHECK-LABEL: Decision,File 0, 5:17 -> 5:23 = M:3, C:2 // CHECK-NEXT: Branch,File 0, 5:17 -> 5:18 = #1, (#0 - #1) [1,2,0] // CHECK: Branch,File 0, 5:22 -> 5:23 = #2, (#1 - #2) [2,0,0] -// CHECK-LABEL: Decision,File 0, 6:17 -> 6:28 = M:1, C:3 +// CHECK-LABEL: Decision,File 0, 6:17 -> 6:28 = M:7, C:3 // CHECK-NEXT: Branch,File 0, 6:17 -> 6:18 = #5, (#0 - #5) [1,3,0] // CHECK: Branch,File 0, 6:22 -> 6:23 = #6, (#5 - #6) [3,2,0] // CHECK: Branch,File 0, 6:27 -> 6:28 = #4, (#3 - #4) [2,0,0] -// CHECK-LABEL: Decision,File 0, 7:17 -> 7:33 = M:2, C:4 +// CHECK-LABEL: Decision,File 0, 7:17 -> 7:33 = M:12, C:4 // CHECK-NEXT: Branch,File 0, 7:17 -> 7:18 = #11, (#0 - #11) [1,4,0] // CHECK: Branch,File 0, 7:22 -> 7:23 = #12, (#11 - #12) [4,3,0] // CHECK: Branch,File 0, 7:27 -> 7:28 = #10, (#9 - #10) [3,2,0] // CHECK: Branch,File 0, 7:32 -> 7:33 = #8, (#7 - #8) [2,0,0] -// CHECK-LABEL: Decision,File 0, 8:17 -> 8:38 = M:4, C:5 +// CHECK-LABEL: Decision,File 0, 8:17 -> 8:38 = M:18, C:5 // CHECK-NEXT: Branch,File 0, 8:17 -> 8:18 = #19, (#0 - #19) [1,5,0] // CHECK: Branch,File 0, 8:22 -> 8:23 = #20, (#19 - #20) [5,4,0] // CHECK: Branch,File 0, 8:27 -> 8:28 = #18, (#17 - #18) [4,3,0] // CHECK: Branch,File 0, 8:32 -> 8:33 = #16, (#15 - #16) [3,2,0] // CHECK: Branch,File 0, 8:37 -> 8:38 = #14, (#13 - #14) [2,0,0] -// CHECK-LABEL: Decision,File 0, 9:17 -> 9:43 = M:8, C:6 +// CHECK-LABEL: Decision,File 0, 9:17 -> 9:43 = M:25, C:6 // CHECK-NEXT: Branch,File 0, 9:17 -> 9:18 = #29, (#0 - #29) [1,6,0] // CHECK: Branch,File 0, 9:22 -> 9:23 = #30, (#29 - #30) [6,5,0] // CHECK: Branch,File 0, 9:27 -> 9:28 = #28, (#27 - #28) [5,4,0] @@ -45,25 +45,25 @@ bool func_scalar_or(bool a, bool b, bool c, bool d, bool e, bool f) { return bar(res1, res2, res3, res4, res5); } -// CHECK-LABEL: Decision,File 0, 40:17 -> 40:23 = M:0, C:2 +// CHECK-LABEL: Decision,File 0, 40:17 -> 40:23 = M:3, C:2 // CHECK-NEXT: Branch,File 0, 40:17 -> 40:18 = (#0 - #1), #1 [1,0,2] // CHECK: Branch,File 0, 40:22 -> 40:23 = (#1 - #2), #2 [2,0,0] -// CHECK-LABEL: Decision,File 0, 41:17 -> 41:28 = M:1, C:3 +// CHECK-LABEL: Decision,File 0, 41:17 -> 41:28 = M:7, C:3 // CHECK-NEXT: Branch,File 0, 41:17 -> 41:18 = (#0 - #5), #5 [1,0,3] // CHECK: Branch,File 0, 41:22 -> 41:23 = (#5 - #6), #6 [3,0,2] // CHECK: Branch,File 0, 41:27 -> 41:28 = (#3 - #4), #4 [2,0,0] -// CHECK-LABEL: Decision,File 0, 42:17 -> 42:33 = M:2, C:4 +// CHECK-LABEL: Decision,File 0, 42:17 -> 42:33 = M:12, C:4 // CHECK-NEXT: Branch,File 0, 42:17 -> 42:18 = (#0 - #11), #11 [1,0,4] // CHECK: Branch,File 0, 42:22 -> 42:23 = (#11 - #12), #12 [4,0,3] // CHECK: Branch,File 0, 42:27 -> 42:28 = (#9 - #10), #10 [3,0,2] // CHECK: Branch,File 0, 42:32 -> 42:33 = (#7 - #8), #8 [2,0,0] -// CHECK-LABEL: Decision,File 0, 43:17 -> 43:38 = M:4, C:5 +// CHECK-LABEL: Decision,File 0, 43:17 -> 43:38 = M:18, C:5 // CHECK-NEXT: Branch,File 0, 43:17 -> 43:18 = (#0 - #19), #19 [1,0,5] // CHECK: Branch,File 0, 43:22 -> 43:23 = (#19 - #20), #20 [5,0,4] // CHECK: Branch,File 0, 43:27 -> 43:28 = (#17 - #18), #18 [4,0,3] // CHECK: Branch,File 0, 43:32 -> 43:33 = (#15 - #16), #16 [3,0,2] // CHECK: Branch,File 0, 43:37 -> 43:38 = (#13 - #14), #14 [2,0,0] -// CHECK-LABEL: Decision,File 0, 44:17 -> 44:43 = M:8, C:6 +// CHECK-LABEL: Decision,File 0, 44:17 -> 44:43 = M:25, C:6 // CHECK-NEXT: Branch,File 0, 44:17 -> 44:18 = (#0 - #29), #29 [1,0,6] // CHECK: Branch,File 0, 44:22 -> 44:23 = (#29 - #30), #30 [6,0,5] // CHECK: Branch,File 0, 44:27 -> 44:28 = (#27 - #28), #28 [5,0,4] @@ -81,26 +81,26 @@ bool func_scalar_mix(bool a, bool b, bool c, bool d, bool e, bool f) { return bar(res1, res2, res3, res4, res5); } -// CHECK-LABEL: Decision,File 0, 76:17 -> 76:23 = M:0, C:2 +// CHECK-LABEL: Decision,File 0, 76:17 -> 76:23 = M:3, C:2 // CHECK-NEXT: Branch,File 0, 76:17 -> 76:18 = (#0 - #1), #1 [1,0,2] // CHECK: Branch,File 0, 76:22 -> 76:23 = (#1 - #2), #2 [2,0,0] -// CHECK-LABEL: Decision,File 0, 77:17 -> 77:30 = M:1, C:3 +// CHECK-LABEL: Decision,File 0, 77:17 -> 77:30 = M:7, C:3 // CHECK-NEXT: Branch,File 0, 77:17 -> 77:18 = #3, (#0 - #3) [1,2,0] // CHECK: Branch,File 0, 77:23 -> 77:24 = (#3 - #4), #4 [2,0,3] // CHECK: Branch,File 0, 77:28 -> 77:29 = (#4 - #5), #5 [3,0,0] -// CHECK-LABEL: Decision,File 0, 78:17 -> 78:37 = M:2, C:4 +// CHECK-LABEL: Decision,File 0, 78:17 -> 78:37 = M:14, C:4 // CHECK-NEXT: File 0 // CHECK-NEXT: Branch,File 0, 78:18 -> 78:19 = (#0 - #7), #7 [1,2,3] // CHECK: Branch,File 0, 78:23 -> 78:24 = (#7 - #8), #8 [3,2,0] // CHECK: Branch,File 0, 78:30 -> 78:31 = (#6 - #9), #9 [2,0,4] // CHECK: Branch,File 0, 78:35 -> 78:36 = (#9 - #10), #10 [4,0,0] -// CHECK-LABEL: Decision,File 0, 79:17 -> 79:42 = M:4, C:5 +// CHECK-LABEL: Decision,File 0, 79:17 -> 79:42 = M:22, C:5 // CHECK-NEXT: Branch,File 0, 79:17 -> 79:18 = #12, (#0 - #12) [1,3,0] // CHECK: Branch,File 0, 79:23 -> 79:24 = (#12 - #13), #13 [3,2,4] // CHECK: Branch,File 0, 79:28 -> 79:29 = (#13 - #14), #14 [4,2,0] // CHECK: Branch,File 0, 79:35 -> 79:36 = (#11 - #15), #15 [2,0,5] // CHECK: Branch,File 0, 79:40 -> 79:41 = (#15 - #16), #16 [5,0,0] -// CHECK-LABEL: Decision,File 0, 80:17 -> 80:49 = M:8, C:6 +// CHECK-LABEL: Decision,File 0, 80:17 -> 80:49 = M:37, C:6 // CHECK-NEXT: File 0 // CHECK-NEXT: Branch,File 0, 80:18 -> 80:19 = (#0 - #19), #19 [1,3,4] // CHECK: Branch,File 0, 80:23 -> 80:24 = (#19 - #20), #20 [4,3,0] diff --git a/clang/test/CoverageMapping/mcdc-logical-stmt-ids-all.cpp b/clang/test/CoverageMapping/mcdc-logical-stmt-ids-all.cpp index 6f47a4b901a8a..d7436079d1810 100644 --- a/clang/test/CoverageMapping/mcdc-logical-stmt-ids-all.cpp +++ b/clang/test/CoverageMapping/mcdc-logical-stmt-ids-all.cpp @@ -6,7 +6,7 @@ bool func_if_and(bool a, bool b, bool c, bool d, bool e, bool f) { return false; } -// CHECK-LABEL: Decision,File 0, 4:7 -> 4:33 = M:0, C:6 +// CHECK-LABEL: Decision,File 0, 4:7 -> 4:33 = M:7, C:6 // CHECK-NEXT: Branch,File 0, 4:7 -> 4:8 = #10, (#0 - #10) [1,6,0] // CHECK: Branch,File 0, 4:12 -> 4:13 = #11, (#10 - #11) [6,5,0] // CHECK: Branch,File 0, 4:17 -> 4:18 = #9, (#8 - #9) [5,4,0] @@ -20,7 +20,7 @@ bool func_if_or(bool a, bool b, bool c, bool d, bool e, bool f) { return false; } -// CHECK-LABEL: Decision,File 0, 18:7 -> 18:33 = M:0, C:6 +// CHECK-LABEL: Decision,File 0, 18:7 -> 18:33 = M:7, C:6 // CHECK-NEXT: Branch,File 0, 18:7 -> 18:8 = (#0 - #10), #10 [1,0,6] // CHECK: Branch,File 0, 18:12 -> 18:13 = (#10 - #11), #11 [6,0,5] // CHECK: Branch,File 0, 18:17 -> 18:18 = (#8 - #9), #9 [5,0,4] @@ -33,7 +33,7 @@ bool func_while_and(bool a, bool b, bool c, bool d, bool e, bool f) { return false; } -// CHECK-LABEL: Decision,File 0, 32:10 -> 32:36 = M:0, C:6 +// CHECK-LABEL: Decision,File 0, 32:10 -> 32:36 = M:7, C:6 // CHECK-NEXT: Branch,File 0, 32:10 -> 32:11 = #10, (#0 - #10) [1,6,0] // CHECK: Branch,File 0, 32:15 -> 32:16 = #11, (#10 - #11) [6,5,0] // CHECK: Branch,File 0, 32:20 -> 32:21 = #9, (#8 - #9) [5,4,0] @@ -46,7 +46,7 @@ bool func_while_or(bool a, bool b, bool c, bool d, bool e, bool f) { return false; } -// CHECK-LABEL: Decision,File 0, 45:10 -> 45:36 = M:0, C:6 +// CHECK-LABEL: Decision,File 0, 45:10 -> 45:36 = M:7, C:6 // CHECK-NEXT: Branch,File 0, 45:10 -> 45:11 = (#0 - #10), #10 [1,0,6] // CHECK: Branch,File 0, 45:15 -> 45:16 = (#10 - #11), #11 [6,0,5] // CHECK: Branch,File 0, 45:20 -> 45:21 = (#8 - #9), #9 [5,0,4] @@ -59,7 +59,7 @@ bool func_for_and(bool a, bool b, bool c, bool d, bool e, bool f) { return false; } -// CHECK-LABEL: Decision,File 0, 58:9 -> 58:35 = M:0, C:6 +// CHECK-LABEL: Decision,File 0, 58:9 -> 58:35 = M:7, C:6 // CHECK-NEXT: Branch,File 0, 58:9 -> 58:10 = #10, (#0 - #10) [1,6,0] // CHECK: Branch,File 0, 58:14 -> 58:15 = #11, (#10 - #11) [6,5,0] // CHECK: Branch,File 0, 58:19 -> 58:20 = #9, (#8 - #9) [5,4,0] @@ -72,7 +72,7 @@ bool func_for_or(bool a, bool b, bool c, bool d, bool e, bool f) { return false; } -// CHECK-LABEL: Decision,File 0, 71:9 -> 71:35 = M:0, C:6 +// CHECK-LABEL: Decision,File 0, 71:9 -> 71:35 = M:7, C:6 // CHECK-NEXT: Branch,File 0, 71:9 -> 71:10 = (#0 - #10), #10 [1,0,6] // CHECK: Branch,File 0, 71:14 -> 71:15 = (#10 - #11), #11 [6,0,5] // CHECK: Branch,File 0, 71:19 -> 71:20 = (#8 - #9), #9 [5,0,4] @@ -85,7 +85,7 @@ bool func_do_and(bool a, bool b, bool c, bool d, bool e, bool f) { return false; } -// CHECK-LABEL: Decision,File 0, 84:16 -> 84:42 = M:0, C:6 +// CHECK-LABEL: Decision,File 0, 84:16 -> 84:42 = M:7, C:6 // CHECK-NEXT: Branch,File 0, 84:16 -> 84:17 = #10, ((#0 + #1) - #10) [1,6,0] // CHECK: Branch,File 0, 84:21 -> 84:22 = #11, (#10 - #11) [6,5,0] // CHECK: Branch,File 0, 84:26 -> 84:27 = #9, (#8 - #9) [5,4,0] @@ -98,7 +98,7 @@ bool func_do_or(bool a, bool b, bool c, bool d, bool e, bool f) { return false; } -// CHECK-LABEL: Decision,File 0, 97:16 -> 97:42 = M:0, C:6 +// CHECK-LABEL: Decision,File 0, 97:16 -> 97:42 = M:7, C:6 // CHECK-NEXT: Branch,File 0, 97:16 -> 97:17 = ((#0 + #1) - #10), #10 [1,0,6] // CHECK: Branch,File 0, 97:21 -> 97:22 = (#10 - #11), #11 [6,0,5] // CHECK: Branch,File 0, 97:26 -> 97:27 = (#8 - #9), #9 [5,0,4] @@ -110,7 +110,7 @@ bool func_ternary_and(bool a, bool b, bool c, bool d, bool e, bool f) { return (a && b && c && d && e && f) ? true : false; } -// CHECK-LABEL: Decision,File 0, 110:11 -> 110:37 = M:0, C:6 +// CHECK-LABEL: Decision,File 0, 110:11 -> 110:37 = M:7, C:6 // CHECK-NEXT: Branch,File 0, 110:11 -> 110:12 = #10, (#0 - #10) [1,6,0] // CHECK: Branch,File 0, 110:16 -> 110:17 = #11, (#10 - #11) [6,5,0] // CHECK: Branch,File 0, 110:21 -> 110:22 = #9, (#8 - #9) [5,4,0] @@ -122,7 +122,7 @@ bool func_ternary_or(bool a, bool b, bool c, bool d, bool e, bool f) { return (a || b || c || d || e || f) ? true : false; } -// CHECK-LABEL: Decision,File 0, 122:11 -> 122:37 = M:0, C:6 +// CHECK-LABEL: Decision,File 0, 122:11 -> 122:37 = M:7, C:6 // CHECK-NEXT: Branch,File 0, 122:11 -> 122:12 = (#0 - #10), #10 [1,0,6] // CHECK: Branch,File 0, 122:16 -> 122:17 = (#10 - #11), #11 [6,0,5] // CHECK: Branch,File 0, 122:21 -> 122:22 = (#8 - #9), #9 [5,0,4] @@ -137,7 +137,7 @@ bool func_if_nested_if(bool a, bool b, bool c, bool d, bool e) { return false; } -// CHECK-LABEL: Decision,File 0, 134:7 -> 134:30 = M:0, C:5 +// CHECK-LABEL: Decision,File 0, 134:7 -> 134:30 = M:8, C:5 // CHECK-NEXT: Branch,File 0, 134:7 -> 134:8 = (#0 - #6), #6 [1,0,4] // CHECK: Branch,File 0, 134:13 -> 134:14 = #7, (#6 - #7) [4,5,3] // CHECK: Branch,File 0, 134:18 -> 134:19 = #8, (#7 - #8) [5,0,3] @@ -148,7 +148,7 @@ bool func_ternary_nested_if(bool a, bool b, bool c, bool d, bool e) { return (a || (b && c) || d || e) ? true : false; } -// CHECK-LABEL: Decision,File 0, 148:11 -> 148:34 = M:0, C:5 +// CHECK-LABEL: Decision,File 0, 148:11 -> 148:34 = M:8, C:5 // CHECK-NEXT: Branch,File 0, 148:11 -> 148:12 = (#0 - #6), #6 [1,0,4] // CHECK: Branch,File 0, 148:17 -> 148:18 = #7, (#6 - #7) [4,5,3] // CHECK: Branch,File 0, 148:22 -> 148:23 = #8, (#7 - #8) [5,0,3] @@ -162,7 +162,7 @@ bool func_if_nested_if_2(bool a, bool b, bool c, bool d, bool e) { return false; } -// CHECK-LABEL: Decision,File 0, 159:7 -> 159:32 = M:0, C:5 +// CHECK-LABEL: Decision,File 0, 159:7 -> 159:32 = M:9, C:5 // CHECK-NEXT: Branch,File 0, 159:7 -> 159:8 = (#0 - #2), #2 [1,0,2] // CHECK: Branch,File 0, 159:14 -> 159:15 = #7, (#2 - #7) [2,5,4] // CHECK: Branch,File 0, 159:19 -> 159:20 = #8, (#7 - #8) [5,3,4] @@ -173,7 +173,7 @@ bool func_ternary_nested_if_2(bool a, bool b, bool c, bool d, bool e) { return (a || ((b && c) || d) && e) ? true : false; } -// CHECK-LABEL: Decision,File 0, 173:11 -> 173:36 = M:0, C:5 +// CHECK-LABEL: Decision,File 0, 173:11 -> 173:36 = M:9, C:5 // CHECK-NEXT: Branch,File 0, 173:11 -> 173:12 = (#0 - #2), #2 [1,0,2] // CHECK: Branch,File 0, 173:18 -> 173:19 = #7, (#2 - #7) [2,5,4] // CHECK: Branch,File 0, 173:23 -> 173:24 = #8, (#7 - #8) [5,3,4] @@ -187,7 +187,7 @@ bool func_if_nested_if_3(bool a, bool b, bool c, bool d, bool e, bool f) { return false; } -// CHECK-LABEL: Decision,File 0, 184:7 -> 184:39 = M:0, C:6 +// CHECK-LABEL: Decision,File 0, 184:7 -> 184:39 = M:12, C:6 // CHECK: Branch,File 0, 184:8 -> 184:9 = #5, (#0 - #5) [1,4,3] // CHECK: Branch,File 0, 184:14 -> 184:15 = (#5 - #6), #6 [4,2,5] // CHECK: Branch,File 0, 184:19 -> 184:20 = (#6 - #7), #7 [5,2,3] @@ -199,7 +199,7 @@ bool func_ternary_nested_if_3(bool a, bool b, bool c, bool d, bool e, bool f) { return ((a && (b || c) || (d && e)) && f) ? true : false; } -// CHECK-LABEL: Decision,File 0, 199:11 -> 199:43 = M:0, C:6 +// CHECK-LABEL: Decision,File 0, 199:11 -> 199:43 = M:12, C:6 // CHECK: Branch,File 0, 199:12 -> 199:13 = #5, (#0 - #5) [1,4,3] // CHECK: Branch,File 0, 199:18 -> 199:19 = (#5 - #6), #6 [4,2,5] // CHECK: Branch,File 0, 199:23 -> 199:24 = (#6 - #7), #7 [5,2,3] diff --git a/clang/test/CoverageMapping/mcdc-logical-stmt-ids.cpp b/clang/test/CoverageMapping/mcdc-logical-stmt-ids.cpp index 99854ec27a3fb..655bbf25ee103 100644 --- a/clang/test/CoverageMapping/mcdc-logical-stmt-ids.cpp +++ b/clang/test/CoverageMapping/mcdc-logical-stmt-ids.cpp @@ -10,25 +10,25 @@ bool func_if_and(bool a, bool b, bool c, bool d, bool e, bool f) { return false; } -// CHECK-LABEL: Decision,File 0, 4:7 -> 4:13 = M:0, C:2 +// CHECK-LABEL: Decision,File 0, 4:7 -> 4:13 = M:3, C:2 // CHECK-NEXT: Branch,File 0, 4:7 -> 4:8 = #2, (#0 - #2) [1,2,0] // CHECK: Branch,File 0, 4:12 -> 4:13 = #3, (#2 - #3) [2,0,0] -// CHECK-LABEL: Decision,File 0, 5:9 -> 5:20 = M:1, C:3 +// CHECK-LABEL: Decision,File 0, 5:9 -> 5:20 = M:7, C:3 // CHECK-NEXT: Branch,File 0, 5:9 -> 5:10 = #7, (#1 - #7) [1,3,0] // CHECK: Branch,File 0, 5:14 -> 5:15 = #8, (#7 - #8) [3,2,0] // CHECK: Branch,File 0, 5:19 -> 5:20 = #6, (#5 - #6) [2,0,0] -// CHECK-LABEL: Decision,File 0, 6:11 -> 6:27 = M:2, C:4 +// CHECK-LABEL: Decision,File 0, 6:11 -> 6:27 = M:12, C:4 // CHECK-NEXT: Branch,File 0, 6:11 -> 6:12 = #14, (#4 - #14) [1,4,0] // CHECK: Branch,File 0, 6:16 -> 6:17 = #15, (#14 - #15) [4,3,0] // CHECK: Branch,File 0, 6:21 -> 6:22 = #13, (#12 - #13) [3,2,0] // CHECK: Branch,File 0, 6:26 -> 6:27 = #11, (#10 - #11) [2,0,0] -// CHECK-LABEL: Decision,File 0, 7:13 -> 7:34 = M:4, C:5 +// CHECK-LABEL: Decision,File 0, 7:13 -> 7:34 = M:18, C:5 // CHECK-NEXT: Branch,File 0, 7:13 -> 7:14 = #23, (#9 - #23) [1,5,0] // CHECK: Branch,File 0, 7:18 -> 7:19 = #24, (#23 - #24) [5,4,0] // CHECK: Branch,File 0, 7:23 -> 7:24 = #22, (#21 - #22) [4,3,0] // CHECK: Branch,File 0, 7:28 -> 7:29 = #20, (#19 - #20) [3,2,0] // CHECK: Branch,File 0, 7:33 -> 7:34 = #18, (#17 - #18) [2,0,0] -// CHECK-LABEL: Decision,File 0, 8:16 -> 8:42 = M:8, C:6 +// CHECK-LABEL: Decision,File 0, 8:16 -> 8:42 = M:25, C:6 // CHECK-NEXT: Branch,File 0, 8:16 -> 8:17 = #34, (#16 - #34) [1,6,0] // CHECK: Branch,File 0, 8:21 -> 8:22 = #35, (#34 - #35) [6,5,0] // CHECK: Branch,File 0, 8:26 -> 8:27 = #33, (#32 - #33) [5,4,0] @@ -46,25 +46,25 @@ bool func_if_or(bool a, bool b, bool c, bool d, bool e, bool f) { return false; } -// CHECK-LABEL: Decision,File 0, 40:7 -> 40:13 = M:0, C:2 +// CHECK-LABEL: Decision,File 0, 40:7 -> 40:13 = M:3, C:2 // CHECK-NEXT: Branch,File 0, 40:7 -> 40:8 = (#0 - #2), #2 [1,0,2] // CHECK: Branch,File 0, 40:12 -> 40:13 = (#2 - #3), #3 [2,0,0] -// CHECK-LABEL: Decision,File 0, 41:9 -> 41:20 = M:1, C:3 +// CHECK-LABEL: Decision,File 0, 41:9 -> 41:20 = M:7, C:3 // CHECK-NEXT: Branch,File 0, 41:9 -> 41:10 = (#1 - #7), #7 [1,0,3] // CHECK: Branch,File 0, 41:14 -> 41:15 = (#7 - #8), #8 [3,0,2] // CHECK: Branch,File 0, 41:19 -> 41:20 = (#5 - #6), #6 [2,0,0] -// CHECK-LABEL: Decision,File 0, 42:11 -> 42:27 = M:2, C:4 +// CHECK-LABEL: Decision,File 0, 42:11 -> 42:27 = M:12, C:4 // CHECK-NEXT: Branch,File 0, 42:11 -> 42:12 = (#4 - #14), #14 [1,0,4] // CHECK: Branch,File 0, 42:16 -> 42:17 = (#14 - #15), #15 [4,0,3] // CHECK: Branch,File 0, 42:21 -> 42:22 = (#12 - #13), #13 [3,0,2] // CHECK: Branch,File 0, 42:26 -> 42:27 = (#10 - #11), #11 [2,0,0] -// CHECK-LABEL: Decision,File 0, 43:13 -> 43:34 = M:4, C:5 +// CHECK-LABEL: Decision,File 0, 43:13 -> 43:34 = M:18, C:5 // CHECK-NEXT: Branch,File 0, 43:13 -> 43:14 = (#9 - #23), #23 [1,0,5] // CHECK: Branch,File 0, 43:18 -> 43:19 = (#23 - #24), #24 [5,0,4] // CHECK: Branch,File 0, 43:23 -> 43:24 = (#21 - #22), #22 [4,0,3] // CHECK: Branch,File 0, 43:28 -> 43:29 = (#19 - #20), #20 [3,0,2] // CHECK: Branch,File 0, 43:33 -> 43:34 = (#17 - #18), #18 [2,0,0] -// CHECK-LABEL: Decision,File 0, 44:16 -> 44:42 = M:8, C:6 +// CHECK-LABEL: Decision,File 0, 44:16 -> 44:42 = M:25, C:6 // CHECK-NEXT: Branch,File 0, 44:16 -> 44:17 = (#16 - #34), #34 [1,0,6] // CHECK: Branch,File 0, 44:21 -> 44:22 = (#34 - #35), #35 [6,0,5] // CHECK: Branch,File 0, 44:26 -> 44:27 = (#32 - #33), #33 [5,0,4] @@ -82,26 +82,26 @@ bool func_if_mix(bool a, bool b, bool c, bool d, bool e, bool f) { return false; } -// CHECK-LABEL: Decision,File 0, 76:7 -> 76:13 = M:0, C:2 +// CHECK-LABEL: Decision,File 0, 76:7 -> 76:13 = M:3, C:2 // CHECK-NEXT: Branch,File 0, 76:7 -> 76:8 = (#0 - #2), #2 [1,0,2] // CHECK: Branch,File 0, 76:12 -> 76:13 = (#2 - #3), #3 [2,0,0] -// CHECK-LABEL: Decision,File 0, 77:9 -> 77:22 = M:1, C:3 +// CHECK-LABEL: Decision,File 0, 77:9 -> 77:22 = M:7, C:3 // CHECK-NEXT: Branch,File 0, 77:9 -> 77:10 = #5, (#1 - #5) [1,2,0] // CHECK: Branch,File 0, 77:15 -> 77:16 = (#5 - #6), #6 [2,0,3] // CHECK: Branch,File 0, 77:20 -> 77:21 = (#6 - #7), #7 [3,0,0] -// CHECK-LABEL: Decision,File 0, 78:11 -> 78:31 = M:2, C:4 +// CHECK-LABEL: Decision,File 0, 78:11 -> 78:31 = M:14, C:4 // CHECK-NEXT: File 0 // CHECK-NEXT: Branch,File 0, 78:12 -> 78:13 = (#4 - #10), #10 [1,2,3] // CHECK: Branch,File 0, 78:17 -> 78:18 = (#10 - #11), #11 [3,2,0] // CHECK: Branch,File 0, 78:24 -> 78:25 = (#9 - #12), #12 [2,0,4] // CHECK: Branch,File 0, 78:29 -> 78:30 = (#12 - #13), #13 [4,0,0] -// CHECK-LABEL: Decision,File 0, 79:13 -> 79:38 = M:4, C:5 +// CHECK-LABEL: Decision,File 0, 79:13 -> 79:38 = M:22, C:5 // CHECK-NEXT: Branch,File 0, 79:13 -> 79:14 = #16, (#8 - #16) [1,3,0] // CHECK: Branch,File 0, 79:19 -> 79:20 = (#16 - #17), #17 [3,2,4] // CHECK: Branch,File 0, 79:24 -> 79:25 = (#17 - #18), #18 [4,2,0] // CHECK: Branch,File 0, 79:31 -> 79:32 = (#15 - #19), #19 [2,0,5] // CHECK: Branch,File 0, 79:36 -> 79:37 = (#19 - #20), #20 [5,0,0] -// CHECK-LABEL: Decision,File 0, 80:15 -> 80:47 = M:8, C:6 +// CHECK-LABEL: Decision,File 0, 80:15 -> 80:47 = M:37, C:6 // CHECK-NEXT: File 0 // CHECK-NEXT: Branch,File 0, 80:16 -> 80:17 = (#14 - #24), #24 [1,3,4] // CHECK: Branch,File 0, 80:21 -> 80:22 = (#24 - #25), #25 [4,3,0] diff --git a/clang/test/CoverageMapping/mcdc-scratch-space.c b/clang/test/CoverageMapping/mcdc-scratch-space.c index 2b5b12d9dcad6..a263e9b688fae 100644 --- a/clang/test/CoverageMapping/mcdc-scratch-space.c +++ b/clang/test/CoverageMapping/mcdc-scratch-space.c @@ -2,14 +2,14 @@ // CHECK: builtin_macro0: int builtin_macro0(int a) { - // CHECK: Decision,File 0, [[@LINE+1]]:11 -> [[@LINE+2]]:15 = M:0, C:2 + // CHECK: Decision,File 0, [[@LINE+1]]:11 -> [[@LINE+2]]:15 = M:3, C:2 return (__LINE__ // CHECK: Branch,File 0, [[@LINE]]:11 -> [[@LINE]]:11 = 0, 0 [1,2,0] && a); // CHECK: Branch,File 0, [[@LINE]]:14 -> [[@LINE]]:15 = #2, (#1 - #2) [2,0,0] } // CHECK: builtin_macro1: int builtin_macro1(int a) { - // CHECK: Decision,File 0, [[@LINE+1]]:11 -> [[@LINE+2]]:22 = M:0, C:2 + // CHECK: Decision,File 0, [[@LINE+1]]:11 -> [[@LINE+2]]:22 = M:3, C:2 return (a // CHECK: Branch,File 0, [[@LINE]]:11 -> [[@LINE]]:12 = (#0 - #1), #1 [1,0,2] || __LINE__); // CHECK: Branch,File 0, [[@LINE]]:14 -> [[@LINE]]:14 = 0, 0 [2,0,0] } @@ -18,7 +18,7 @@ int builtin_macro1(int a) { // CHECK: pre0: int pre0(int pre_a, int b_post) { - // CHECK: Decision,File 0, [[@LINE+2]]:11 -> [[@LINE+3]]:20 = M:0, C:2 + // CHECK: Decision,File 0, [[@LINE+2]]:11 -> [[@LINE+3]]:20 = M:3, C:2 // CHECK: Expansion,File 0, [[@LINE+1]]:11 -> [[@LINE+1]]:14 = #0 (Expanded file = 1) return (PRE(a) && b_post); @@ -30,7 +30,7 @@ int pre0(int pre_a, int b_post) { // CHECK: pre1: int pre1(int pre_a, int b_post) { - // CHECK: Decision,File 0, [[@LINE+3]]:11 -> [[@LINE+4]]:20 = M:0, C:2 + // CHECK: Decision,File 0, [[@LINE+3]]:11 -> [[@LINE+4]]:20 = M:3, C:2 // CHECK: Expansion,File 0, [[@LINE+2]]:11 -> [[@LINE+2]]:14 = #0 (Expanded file = 1) // CHECK: Branch,File 0, [[@LINE+2]]:14 -> [[@LINE+2]]:20 = #2, (#1 - #2) [2,0,0] return (PRE(foo) @@ -43,7 +43,7 @@ int pre1(int pre_a, int b_post) { // CHECK: post0: int post0(int pre_a, int b_post) { - // CHECK: Decision,File 0, [[@LINE+2]]:11 -> [[@LINE+3]]:18 = M:0, C:2 + // CHECK: Decision,File 0, [[@LINE+2]]:11 -> [[@LINE+3]]:18 = M:3, C:2 // CHECK: Branch,File 0, [[@LINE+1]]:11 -> [[@LINE+1]]:16 = (#0 - #1), #1 [1,0,2] return (pre_a || POST(b)); @@ -55,7 +55,7 @@ int post0(int pre_a, int b_post) { // CHECK: post1: int post1(int pre_a, int b_post) { - // CHECK: Decision,File 0, [[@LINE+3]]:11 -> [[@LINE+4]]:18 = M:0, C:2 + // CHECK: Decision,File 0, [[@LINE+3]]:11 -> [[@LINE+4]]:18 = M:3, C:2 // CHECK: Branch,File 0, [[@LINE+2]]:11 -> [[@LINE+2]]:16 = (#0 - #1), #1 [1,0,2] // CHECK: Expansion,File 0, [[@LINE+2]]:14 -> [[@LINE+2]]:18 = 0 (Expanded file = 1) return (pre_a diff --git a/clang/test/CoverageMapping/mcdc-system-headers.cpp b/clang/test/CoverageMapping/mcdc-system-headers.cpp index 4dfbb17c2bba8..ae26ed5fe469f 100644 --- a/clang/test/CoverageMapping/mcdc-system-headers.cpp +++ b/clang/test/CoverageMapping/mcdc-system-headers.cpp @@ -15,7 +15,7 @@ // CHECK: _Z5func0i: int func0(int a) { - // CHECK: Decision,File 0, [[@LINE+3]]:11 -> [[@LINE+3]]:21 = M:0, C:2 + // CHECK: Decision,File 0, [[@LINE+3]]:11 -> [[@LINE+3]]:21 = M:3, C:2 // W_SYS: Expansion,File 0, [[@LINE+2]]:11 -> [[@LINE+2]]:16 = #0 (Expanded file = 1) // X_SYS: Branch,File 0, [[@LINE+1]]:11 -> [[@LINE+1]]:11 = 0, 0 [1,2,0] return (CONST && a); @@ -25,7 +25,7 @@ int func0(int a) { // CHECK: _Z5func1ii: int func1(int a, int b) { - // CHECK: Decision,File 0, [[@LINE+2]]:11 -> [[@LINE+2]]:21 = M:0, C:2 + // CHECK: Decision,File 0, [[@LINE+2]]:11 -> [[@LINE+2]]:21 = M:3, C:2 // CHECK: Branch,File 0, [[@LINE+1]]:11 -> [[@LINE+1]]:12 = (#0 - #1), #1 [1,0,2] return (a || EXPR1(b)); // W_SYS: Expansion,File 0, [[@LINE-1]]:16 -> [[@LINE-1]]:21 = #1 (Expanded file = 1) @@ -35,8 +35,8 @@ int func1(int a, int b) { // CHECK: _Z5func2ii: int func2(int a, int b) { - // W_SYS: Decision,File 0, [[@LINE+5]]:11 -> [[@LINE+5]]:28 = M:0, C:3 - // X_SYS: Decision,File 0, [[@LINE+4]]:11 -> [[@LINE+4]]:28 = M:0, C:2 + // W_SYS: Decision,File 0, [[@LINE+5]]:11 -> [[@LINE+5]]:28 = M:4, C:3 + // X_SYS: Decision,File 0, [[@LINE+4]]:11 -> [[@LINE+4]]:28 = M:3, C:2 // W_SYS: Expansion,File 0, [[@LINE+3]]:11 -> [[@LINE+3]]:16 = #0 (Expanded file = 1) // W_SYS: Expansion,File 0, [[@LINE+2]]:23 -> [[@LINE+2]]:28 = #1 (Expanded file = 2) // X_SYS: Branch,File 0, [[@LINE+1]]:11 -> [[@LINE+1]]:11 = #1, (#0 - #1) [1,2,0] diff --git a/clang/test/Profile/c-mcdc-class.cpp b/clang/test/Profile/c-mcdc-class.cpp index 6aab55add3280..748344194ef86 100644 --- a/clang/test/Profile/c-mcdc-class.cpp +++ b/clang/test/Profile/c-mcdc-class.cpp @@ -36,23 +36,24 @@ Value::~Value(void) { // SHIFT FIRST CONDITION WITH ID = 0. // MCDCCTOR: %[[LAB1:[0-9]+]] = load i32, ptr %value, align 4 // MCDCCTOR-DAG: %[[BOOL:cmp[0-9]*]] = icmp ne i32 %[[LAB1]], 2 -// MCDCCTOR-DAG: %[[TEMP:mcdc.temp[0-9]*]] = load i32, ptr %mcdc.addr, align 4 -// MCDCCTOR-DAG: %[[LAB2:[0-9]+]] = zext i1 %[[BOOL]] to i32 -// MCDCCTOR-DAG: %[[LAB3:[0-9]+]] = shl i32 %[[LAB2]], 0 -// MCDCCTOR-DAG: %[[LAB4:[0-9]+]] = or i32 %[[TEMP]], %[[LAB3]] +// MCDCCTOR-DAG: %[[TEMP:mcdc.*]] = load i32, ptr %mcdc.addr, align 4 +// MCDCCTOR-DAG: %[[LAB2:[0-9]+]] = add i32 %[[TEMP]], 0 +// MCDCCTOR-DAG: %[[LAB3:[0-9]+]] = add i32 %[[TEMP]], 0 +// MCDCCTOR-DAG: %[[LAB4:[0-9]+]] = select i1 %[[BOOL]], i32 %[[LAB2]], i32 %[[LAB3]] // MCDCCTOR-DAG: store i32 %[[LAB4]], ptr %mcdc.addr, align 4 // SHIFT SECOND CONDITION WITH ID = 1. // MCDCCTOR: %[[LAB1:[0-9]+]] = load i32, ptr %value2, align 4 // MCDCCTOR-DAG: %[[BOOL:cmp[0-9]*]] = icmp ne i32 %[[LAB1]], 6 -// MCDCCTOR-DAG: %[[TEMP:mcdc.temp[0-9]*]] = load i32, ptr %mcdc.addr, align 4 -// MCDCCTOR-DAG: %[[LAB2:[0-9]+]] = zext i1 %[[BOOL]] to i32 -// MCDCCTOR-DAG: %[[LAB3:[0-9]+]] = shl i32 %[[LAB2]], 1 -// MCDCCTOR-DAG: %[[LAB4:[0-9]+]] = or i32 %[[TEMP]], %[[LAB3]] +// MCDCCTOR-DAG: %[[TEMP:mcdc.*]] = load i32, ptr %mcdc.addr, align 4 +// MCDCCTOR-DAG: %[[LAB2:[0-9]+]] = add i32 %[[TEMP]], 2 +// MCDCCTOR-DAG: %[[LAB3:[0-9]+]] = add i32 %[[TEMP]], 1 +// MCDCCTOR-DAG: %[[LAB4:[0-9]+]] = select i1 %[[BOOL]], i32 %[[LAB2]], i32 %[[LAB3]] // MCDCCTOR-DAG: store i32 %[[LAB4]], ptr %mcdc.addr, align 4 // UPDATE FINAL BITMASK WITH RESULT. -// MCDCCTOR-DAG: %[[TEMP:mcdc.temp[0-9]*]] = load i32, ptr %mcdc.addr, align 4 +// MCDCCTOR-DAG: %[[TEMP0:mcdc.temp[0-9]*]] = load i32, ptr %mcdc.addr, align 4 +// MCDCCTOR: %[[TEMP:[0-9]+]] = add i32 %[[TEMP0]], 0 // MCDCCTOR: %[[LAB1:[0-9]+]] = lshr i32 %[[TEMP]], 3 // MCDCCTOR: %[[LAB4:[0-9]+]] = getelementptr inbounds i8, ptr @__profbm__ZN5ValueC2Ev, i32 %[[LAB1]] // MCDCCTOR: %[[LAB5:[0-9]+]] = and i32 %[[TEMP]], 7 @@ -73,23 +74,24 @@ Value::~Value(void) { // SHIFT FIRST CONDITION WITH ID = 0. // MCDCDTOR: %[[LAB1:[0-9]+]] = load i32, ptr %value, align 4 // MCDCDTOR-DAG: %[[BOOL:cmp[0-9]*]] = icmp ne i32 %[[LAB1]], 2 -// MCDCDTOR-DAG: %[[TEMP:mcdc.temp[0-9]*]] = load i32, ptr %mcdc.addr, align 4 -// MCDCDTOR-DAG: %[[LAB2:[0-9]+]] = zext i1 %[[BOOL]] to i32 -// MCDCDTOR-DAG: %[[LAB3:[0-9]+]] = shl i32 %[[LAB2]], 0 -// MCDCDTOR-DAG: %[[LAB4:[0-9]+]] = or i32 %[[TEMP]], %[[LAB3]] +// MCDCDTOR-DAG: %[[TEMP:mcdc.*]] = load i32, ptr %mcdc.addr, align 4 +// MCDCDTOR-DAG: %[[LAB2:[0-9]+]] = add i32 %[[TEMP]], 0 +// MCDCDTOR-DAG: %[[LAB3:[0-9]+]] = add i32 %[[TEMP]], 0 +// MCDCDTOR-DAG: %[[LAB4:[0-9]+]] = select i1 %[[BOOL]], i32 %[[LAB2]], i32 %[[LAB3]] // MCDCDTOR-DAG: store i32 %[[LAB4]], ptr %mcdc.addr, align 4 // SHIFT SECOND CONDITION WITH ID = 1. // MCDCDTOR: %[[LAB1:[0-9]+]] = load i32, ptr %value2, align 4 // MCDCDTOR-DAG: %[[BOOL:cmp[0-9]*]] = icmp ne i32 %[[LAB1]], 3 -// MCDCDTOR-DAG: %[[TEMP:mcdc.temp[0-9]*]] = load i32, ptr %mcdc.addr, align 4 -// MCDCDTOR-DAG: %[[LAB2:[0-9]+]] = zext i1 %[[BOOL]] to i32 -// MCDCDTOR-DAG: %[[LAB3:[0-9]+]] = shl i32 %[[LAB2]], 1 -// MCDCDTOR-DAG: %[[LAB4:[0-9]+]] = or i32 %[[TEMP]], %[[LAB3]] +// MCDCDTOR-DAG: %[[TEMP:mcdc.*]] = load i32, ptr %mcdc.addr, align 4 +// MCDCDTOR-DAG: %[[LAB2:[0-9]+]] = add i32 %[[TEMP]], 2 +// MCDCDTOR-DAG: %[[LAB3:[0-9]+]] = add i32 %[[TEMP]], 1 +// MCDCDTOR-DAG: %[[LAB4:[0-9]+]] = select i1 %[[BOOL]], i32 %[[LAB2]], i32 %[[LAB3]] // MCDCDTOR-DAG: store i32 %[[LAB4]], ptr %mcdc.addr, align 4 // UPDATE FINAL BITMASK WITH RESULT. -// MCDCDTOR-DAG: %[[TEMP:mcdc.temp[0-9]*]] = load i32, ptr %mcdc.addr, align 4 +// MCDCDTOR-DAG: %[[TEMP0:mcdc.temp[0-9]*]] = load i32, ptr %mcdc.addr, align 4 +// MCDCDTOR: %[[TEMP:[0-9]+]] = add i32 %[[TEMP0]], 0 // MCDCDTOR: %[[LAB1:[0-9]+]] = lshr i32 %[[TEMP]], 3 // MCDCDTOR: %[[LAB4:[0-9]+]] = getelementptr inbounds i8, ptr @__profbm__ZN5ValueD2Ev, i32 %[[LAB1]] // MCDCDTOR: %[[LAB5:[0-9]+]] = and i32 %[[TEMP]], 7 diff --git a/clang/test/Profile/c-mcdc-logicalop-ternary.c b/clang/test/Profile/c-mcdc-logicalop-ternary.c index 3e6b6b1e380d1..91174befb5fe5 100644 --- a/clang/test/Profile/c-mcdc-logicalop-ternary.c +++ b/clang/test/Profile/c-mcdc-logicalop-ternary.c @@ -9,7 +9,7 @@ int test(int a, int b, int c, int d, int e, int f) { // NOMCDC-NOT: __profbm_test // MCDC BOOKKEEPING. -// MCDC: @__profbm_test = private global [3 x i8] zeroinitializer +// MCDC: @__profbm_test = private global [2 x i8] zeroinitializer // ALLOCATE MCDC TEMP AND ZERO IT. // MCDC-LABEL: @test( @@ -18,7 +18,8 @@ int test(int a, int b, int c, int d, int e, int f) { // TERNARY TRUE SHOULD UPDATE THE BITMAP WITH RESULT AT ELEMENT 0. // MCDC-LABEL: cond.true: -// MCDC-DAG: %[[TEMP:mcdc.temp[0-9]*]] = load i32, ptr %mcdc.addr, align 4 +// MCDC-DAG: %[[TEMP0:mcdc.temp[0-9]*]] = load i32, ptr %mcdc.addr, align 4 +// MCDC: %[[TEMP:[0-9]+]] = add i32 %[[TEMP0]], 0 // MCDC: %[[LAB1:[0-9]+]] = lshr i32 %[[TEMP]], 3 // MCDC: %[[LAB4:[0-9]+]] = getelementptr inbounds i8, ptr @__profbm_test, i32 %[[LAB1]] // MCDC: %[[LAB5:[0-9]+]] = and i32 %[[TEMP]], 7 @@ -34,9 +35,10 @@ int test(int a, int b, int c, int d, int e, int f) { // TERNARY TRUE YIELDS TERNARY LHS LOGICAL-AND. // TERNARY LHS LOGICAL-AND SHOULD UPDATE THE BITMAP WITH RESULT AT ELEMENT 1. // MCDC-LABEL: land.end: -// MCDC-DAG: %[[TEMP:mcdc.temp[0-9]*]] = load i32, ptr %mcdc.addr, align 4 +// MCDC-DAG: %[[TEMP0:mcdc.temp[0-9]*]] = load i32, ptr %mcdc.addr, align 4 +// MCDC: %[[TEMP:[0-9]+]] = add i32 %[[TEMP0]], 3 // MCDC: %[[LAB1:[0-9]+]] = lshr i32 %[[TEMP]], 3 -// MCDC: %[[LAB4:[0-9]+]] = getelementptr inbounds i8, ptr getelementptr inbounds ([3 x i8], ptr @__profbm_test, i32 0, i32 1), i32 %[[LAB1]] +// MCDC: %[[LAB4:[0-9]+]] = getelementptr inbounds i8, ptr @__profbm_test, i32 %[[LAB1]] // MCDC: %[[LAB5:[0-9]+]] = and i32 %[[TEMP]], 7 // MCDC: %[[LAB6:[0-9]+]] = trunc i32 %[[LAB5]] to i8 // MCDC: %[[LAB7:[0-9]+]] = shl i8 1, %[[LAB6]] @@ -46,7 +48,8 @@ int test(int a, int b, int c, int d, int e, int f) { // TERNARY FALSE SHOULD UPDATE THE BITMAP WITH RESULT AT ELEMENT 0. // MCDC-LABEL: cond.false: -// MCDC-DAG: %[[TEMP:mcdc.temp[0-9]*]] = load i32, ptr %mcdc.addr, align 4 +// MCDC-DAG: %[[TEMP0:mcdc.temp[0-9]*]] = load i32, ptr %mcdc.addr, align 4 +// MCDC: %[[TEMP:[0-9]+]] = add i32 %[[TEMP0]], 0 // MCDC: %[[LAB1:[0-9]+]] = lshr i32 %[[TEMP]], 3 // MCDC: %[[LAB4:[0-9]+]] = getelementptr inbounds i8, ptr @__profbm_test, i32 %[[LAB1]] // MCDC: %[[LAB5:[0-9]+]] = and i32 %[[TEMP]], 7 @@ -62,9 +65,10 @@ int test(int a, int b, int c, int d, int e, int f) { // TERNARY FALSE YIELDS TERNARY RHS LOGICAL-OR. // TERNARY RHS LOGICAL-OR SHOULD UPDATE THE BITMAP WITH RESULT AT ELEMENT 2. // MCDC-LABEL: lor.end: -// MCDC-DAG: %[[TEMP:mcdc.temp[0-9]*]] = load i32, ptr %mcdc.addr, align 4 +// MCDC-DAG: %[[TEMP0:mcdc.temp[0-9]*]] = load i32, ptr %mcdc.addr, align 4 +// MCDC: %[[TEMP:[0-9]+]] = add i32 %[[TEMP0]], 6 // MCDC: %[[LAB1:[0-9]+]] = lshr i32 %[[TEMP]], 3 -// MCDC: %[[LAB4:[0-9]+]] = getelementptr inbounds i8, ptr getelementptr inbounds ([3 x i8], ptr @__profbm_test, i32 0, i32 2), i32 %[[LAB1]] +// MCDC: %[[LAB4:[0-9]+]] = getelementptr inbounds i8, ptr @__profbm_test, i32 %[[LAB1]] // MCDC: %[[LAB5:[0-9]+]] = and i32 %[[TEMP]], 7 // MCDC: %[[LAB6:[0-9]+]] = trunc i32 %[[LAB5]] to i8 // MCDC: %[[LAB7:[0-9]+]] = shl i8 1, %[[LAB6]] diff --git a/clang/test/Profile/c-mcdc-nested-ternary.c b/clang/test/Profile/c-mcdc-nested-ternary.c index ebea17ca146ae..8576ba39e583b 100644 --- a/clang/test/Profile/c-mcdc-nested-ternary.c +++ b/clang/test/Profile/c-mcdc-nested-ternary.c @@ -20,42 +20,43 @@ int test(int b, int c, int d, int e, int f) { // MCDC-LABEL: cond.true: // MCDC: %[[LAB1:[0-9]+]] = load i32, ptr %c.addr, align 4 // MCDC-DAG: %[[BOOL:tobool[0-9]*]] = icmp ne i32 %[[LAB1]], 0 -// MCDC-DAG: %[[TEMP:mcdc.temp[0-9]*]] = load i32, ptr %mcdc.addr, align 4 -// MCDC-DAG: %[[LAB2:[0-9]+]] = zext i1 %[[BOOL]] to i32 -// MCDC-DAG: %[[LAB3:[0-9]+]] = shl i32 %[[LAB2]], 0 -// MCDC-DAG: %[[LAB4:[0-9]+]] = or i32 %[[TEMP]], %[[LAB3]] +// MCDC-DAG: %[[TEMP:mcdc.*]] = load i32, ptr %mcdc.addr, align 4 +// MCDC-DAG: %[[LAB2:[0-9]+]] = add i32 %[[TEMP]], 0 +// MCDC-DAG: %[[LAB3:[0-9]+]] = add i32 %[[TEMP]], 0 +// MCDC-DAG: %[[LAB4:[0-9]+]] = select i1 %[[BOOL]], i32 %[[LAB2]], i32 %[[LAB3]] // MCDC-DAG: store i32 %[[LAB4]], ptr %mcdc.addr, align 4 // TERNARY FALSE SHOULD SHIFT ID = 0 FOR CONDITION 'd'. // MCDC-LABEL: cond.false: // MCDC: %[[LAB1:[0-9]+]] = load i32, ptr %d.addr, align 4 // MCDC-DAG: %[[BOOL:tobool[0-9]*]] = icmp ne i32 %[[LAB1]], 0 -// MCDC-DAG: %[[TEMP:mcdc.temp[0-9]*]] = load i32, ptr %mcdc.addr, align 4 -// MCDC-DAG: %[[LAB2:[0-9]+]] = zext i1 %[[BOOL]] to i32 -// MCDC-DAG: %[[LAB3:[0-9]+]] = shl i32 %[[LAB2]], 0 -// MCDC-DAG: %[[LAB4:[0-9]+]] = or i32 %[[TEMP]], %[[LAB3]] +// MCDC-DAG: %[[TEMP:mcdc.*]] = load i32, ptr %mcdc.addr, align 4 +// MCDC-DAG: %[[LAB2:[0-9]+]] = add i32 %[[TEMP]], 0 +// MCDC-DAG: %[[LAB3:[0-9]+]] = add i32 %[[TEMP]], 0 +// MCDC-DAG: %[[LAB4:[0-9]+]] = select i1 %[[BOOL]], i32 %[[LAB2]], i32 %[[LAB3]] // MCDC-DAG: store i32 %[[LAB4]], ptr %mcdc.addr, align 4 // SHIFT SECOND CONDITION WITH ID = 2. // MCDC: %[[LAB1:[0-9]+]] = load i32, ptr %e.addr, align 4 // MCDC-DAG: %[[BOOL:tobool[0-9]*]] = icmp ne i32 %[[LAB1]], 0 -// MCDC-DAG: %[[TEMP:mcdc.temp[0-9]*]] = load i32, ptr %mcdc.addr, align 4 -// MCDC-DAG: %[[LAB2:[0-9]+]] = zext i1 %[[BOOL]] to i32 -// MCDC-DAG: %[[LAB3:[0-9]+]] = shl i32 %[[LAB2]], 2 -// MCDC-DAG: %[[LAB4:[0-9]+]] = or i32 %[[TEMP]], %[[LAB3]] +// MCDC-DAG: %[[TEMP:mcdc.*]] = load i32, ptr %mcdc.addr, align 4 +// MCDC-DAG: %[[LAB2:[0-9]+]] = add i32 %[[TEMP]], 0 +// MCDC-DAG: %[[LAB3:[0-9]+]] = add i32 %[[TEMP]], 1 +// MCDC-DAG: %[[LAB4:[0-9]+]] = select i1 %[[BOOL]], i32 %[[LAB2]], i32 %[[LAB3]] // MCDC-DAG: store i32 %[[LAB4]], ptr %mcdc.addr, align 4 // SHIFT THIRD CONDITION WITH ID = 1. // MCDC: %[[LAB1:[0-9]+]] = load i32, ptr %f.addr, align 4 // MCDC-DAG: %[[BOOL:tobool[0-9]*]] = icmp ne i32 %[[LAB1]], 0 -// MCDC-DAG: %[[TEMP:mcdc.temp[0-9]*]] = load i32, ptr %mcdc.addr, align 4 -// MCDC-DAG: %[[LAB2:[0-9]+]] = zext i1 %[[BOOL]] to i32 -// MCDC-DAG: %[[LAB3:[0-9]+]] = shl i32 %[[LAB2]], 1 -// MCDC-DAG: %[[LAB4:[0-9]+]] = or i32 %[[TEMP]], %[[LAB3]] +// MCDC-DAG: %[[TEMP:mcdc.*]] = load i32, ptr %mcdc.addr, align 4 +// MCDC-DAG: %[[LAB2:[0-9]+]] = add i32 %[[TEMP]], 3 +// MCDC-DAG: %[[LAB3:[0-9]+]] = add i32 %[[TEMP]], 2 +// MCDC-DAG: %[[LAB4:[0-9]+]] = select i1 %[[BOOL]], i32 %[[LAB2]], i32 %[[LAB3]] // MCDC-DAG: store i32 %[[LAB4]], ptr %mcdc.addr, align 4 // UPDATE FINAL BITMASK WITH RESULT. -// MCDC-DAG: %[[TEMP:mcdc.temp[0-9]*]] = load i32, ptr %mcdc.addr, align 4 +// MCDC-DAG: %[[TEMP0:mcdc.temp[0-9]*]] = load i32, ptr %mcdc.addr, align 4 +// MCDC: %[[TEMP:[0-9]+]] = add i32 %[[TEMP0]], 0 // MCDC: %[[LAB1:[0-9]+]] = lshr i32 %[[TEMP]], 3 // MCDC: %[[LAB4:[0-9]+]] = getelementptr inbounds i8, ptr @__profbm_test, i32 %[[LAB1]] // MCDC: %[[LAB5:[0-9]+]] = and i32 %[[TEMP]], 7 diff --git a/clang/test/Profile/c-mcdc-not.c b/clang/test/Profile/c-mcdc-not.c index 165bfbae3349d..ae683c3fe40fe 100644 --- a/clang/test/Profile/c-mcdc-not.c +++ b/clang/test/Profile/c-mcdc-not.c @@ -9,7 +9,7 @@ int test(int a, int b, int c, int d, int e, int f) { // NOMCDC-NOT: __profbm_test // MCDC BOOKKEEPING. -// MCDC: @__profbm_test = private global [8 x i8] zeroinitializer +// MCDC: @__profbm_test = private global [2 x i8] zeroinitializer // MCDC: @__profc_test = private global [9 x i64] zeroinitializer // ALLOCATE MCDC TEMP AND ZERO IT. @@ -21,61 +21,62 @@ int test(int a, int b, int c, int d, int e, int f) { // MCDC: %[[LAB1:[0-9]+]] = load i32, ptr %a.addr, align 4 // MCDC-DAG: %[[BOOL:tobool[0-9]*]] = icmp ne i32 %[[LAB1]], 0 // MCDC-DAG: %[[LNOT:lnot[0-9]*]] = xor i1 %[[BOOL]] -// MCDC-DAG: %[[TEMP:mcdc.temp[0-9]*]] = load i32, ptr %mcdc.addr, align 4 -// MCDC-DAG: %[[LAB2:[0-9]+]] = zext i1 %[[LNOT]] to i32 -// MCDC-DAG: %[[LAB3:[0-9]+]] = shl i32 %[[LAB2]], 0 -// MCDC-DAG: %[[LAB4:[0-9]+]] = or i32 %[[TEMP]], %[[LAB3]] +// MCDC-DAG: %[[TEMP:mcdc.*]] = load i32, ptr %mcdc.addr, align 4 +// MCDC-DAG: %[[LAB2:[0-9]+]] = add i32 %[[TEMP]], 0 +// MCDC-DAG: %[[LAB3:[0-9]+]] = add i32 %[[TEMP]], 0 +// MCDC-DAG: %[[LAB4:[0-9]+]] = select i1 %[[LNOT]], i32 %[[LAB2]], i32 %[[LAB3]] // MCDC-DAG: store i32 %[[LAB4]], ptr %mcdc.addr, align 4 // SHIFT SECOND CONDITION WITH ID = 2. // MCDC: %[[LAB1:[0-9]+]] = load i32, ptr %b.addr, align 4 // MCDC-DAG: %[[BOOL:tobool[0-9]*]] = icmp ne i32 %[[LAB1]], 0 -// MCDC-DAG: %[[TEMP:mcdc.temp[0-9]*]] = load i32, ptr %mcdc.addr, align 4 -// MCDC-DAG: %[[LAB2:[0-9]+]] = zext i1 %[[BOOL]] to i32 -// MCDC-DAG: %[[LAB3:[0-9]+]] = shl i32 %[[LAB2]], 2 -// MCDC-DAG: %[[LAB4:[0-9]+]] = or i32 %[[TEMP]], %[[LAB3]] +// MCDC-DAG: %[[TEMP:mcdc.*]] = load i32, ptr %mcdc.addr, align 4 +// MCDC-DAG: %[[LAB2:[0-9]+]] = add i32 %[[TEMP]], 14 +// MCDC-DAG: %[[LAB3:[0-9]+]] = add i32 %[[TEMP]], 1 +// MCDC-DAG: %[[LAB4:[0-9]+]] = select i1 %[[BOOL]], i32 %[[LAB2]], i32 %[[LAB3]] // MCDC-DAG: store i32 %[[LAB4]], ptr %mcdc.addr, align 4 // SHIFT THIRD CONDITION WITH ID = 1. // MCDC: %[[LAB1:[0-9]+]] = load i32, ptr %c.addr, align 4 // MCDC-DAG: %[[BOOL:tobool[0-9]*]] = icmp ne i32 %[[LAB1]], 0 // MCDC-DAG: %[[LNOT:lnot[0-9]*]] = xor i1 %[[BOOL]] -// MCDC-DAG: %[[TEMP:mcdc.temp[0-9]*]] = load i32, ptr %mcdc.addr, align 4 -// MCDC-DAG: %[[LAB2:[0-9]+]] = zext i1 %[[LNOT]] to i32 -// MCDC-DAG: %[[LAB3:[0-9]+]] = shl i32 %[[LAB2]], 1 -// MCDC-DAG: %[[LAB4:[0-9]+]] = or i32 %[[TEMP]], %[[LAB3]] +// MCDC-DAG: %[[TEMP:mcdc.*]] = load i32, ptr %mcdc.addr, align 4 +// MCDC-DAG: %[[LAB2:[0-9]+]] = add i32 %[[TEMP]], 0 +// MCDC-DAG: %[[LAB3:[0-9]+]] = add i32 %[[TEMP]], 0 +// MCDC-DAG: %[[LAB4:[0-9]+]] = select i1 %[[LNOT]], i32 %[[LAB2]], i32 %[[LAB3]] // MCDC-DAG: store i32 %[[LAB4]], ptr %mcdc.addr, align 4 // SHIFT FOURTH CONDITION WITH ID = 4. // MCDC: %[[LAB1:[0-9]+]] = load i32, ptr %d.addr, align 4 // MCDC-DAG: %[[BOOL:tobool[0-9]*]] = icmp ne i32 %[[LAB1]], 0 -// MCDC-DAG: %[[TEMP:mcdc.temp[0-9]*]] = load i32, ptr %mcdc.addr, align 4 -// MCDC-DAG: %[[LAB2:[0-9]+]] = zext i1 %[[BOOL]] to i32 -// MCDC-DAG: %[[LAB3:[0-9]+]] = shl i32 %[[LAB2]], 4 -// MCDC-DAG: %[[LAB4:[0-9]+]] = or i32 %[[TEMP]], %[[LAB3]] +// MCDC-DAG: %[[TEMP:mcdc.*]] = load i32, ptr %mcdc.addr, align 4 +// MCDC-DAG: %[[LAB2:[0-9]+]] = add i32 %[[TEMP]], 12 +// MCDC-DAG: %[[LAB3:[0-9]+]] = add i32 %[[TEMP]], 2 +// MCDC-DAG: %[[LAB4:[0-9]+]] = select i1 %[[BOOL]], i32 %[[LAB2]], i32 %[[LAB3]] // MCDC-DAG: store i32 %[[LAB4]], ptr %mcdc.addr, align 4 // SHIFT FIFTH CONDITION WITH ID = 3. // MCDC: %[[LAB1:[0-9]+]] = load i32, ptr %e.addr, align 4 // MCDC-DAG: %[[BOOL:tobool[0-9]*]] = icmp ne i32 %[[LAB1]], 0 -// MCDC-DAG: %[[TEMP:mcdc.temp[0-9]*]] = load i32, ptr %mcdc.addr, align 4 -// MCDC-DAG: %[[LAB2:[0-9]+]] = zext i1 %[[BOOL]] to i32 -// MCDC-DAG: %[[LAB3:[0-9]+]] = shl i32 %[[LAB2]], 3 -// MCDC-DAG: %[[LAB4:[0-9]+]] = or i32 %[[TEMP]], %[[LAB3]] +// MCDC-DAG: %[[TEMP:mcdc.*]] = load i32, ptr %mcdc.addr, align 4 +// MCDC-DAG: %[[LAB2:[0-9]+]] = add i32 %[[TEMP]], 0 +// MCDC-DAG: %[[LAB3:[0-9]+]] = add i32 %[[TEMP]], 0 +// MCDC-DAG: %[[LAB4:[0-9]+]] = select i1 %[[BOOL]], i32 %[[LAB2]], i32 %[[LAB3]] // MCDC-DAG: store i32 %[[LAB4]], ptr %mcdc.addr, align 4 // SHIFT SIXTH CONDITION WITH ID = 5. // MCDC: %[[LAB1:[0-9]+]] = load i32, ptr %f.addr, align 4 // MCDC-DAG: %[[BOOL:tobool[0-9]*]] = icmp ne i32 %[[LAB1]], 0 // MCDC-DAG: %[[LNOT:lnot[0-9]*]] = xor i1 %[[BOOL]] -// MCDC-DAG: %[[TEMP:mcdc.temp[0-9]*]] = load i32, ptr %mcdc.addr, align 4 -// MCDC-DAG: %[[LAB2:[0-9]+]] = zext i1 %[[LNOT]] to i32 -// MCDC-DAG: %[[LAB3:[0-9]+]] = shl i32 %[[LAB2]], 5 -// MCDC-DAG: %[[LAB4:[0-9]+]] = or i32 %[[TEMP]], %[[LAB3]] +// MCDC-DAG: %[[TEMP:mcdc.*]] = load i32, ptr %mcdc.addr, align 4 +// MCDC-DAG: %[[LAB2:[0-9]+]] = add i32 %[[TEMP]], 8 +// MCDC-DAG: %[[LAB3:[0-9]+]] = add i32 %[[TEMP]], 4 +// MCDC-DAG: %[[LAB4:[0-9]+]] = select i1 %[[LNOT]], i32 %[[LAB2]], i32 %[[LAB3]] // MCDC-DAG: store i32 %[[LAB4]], ptr %mcdc.addr, align 4 // UPDATE FINAL BITMASK WITH RESULT. -// MCDC-DAG: %[[TEMP:mcdc.temp[0-9]*]] = load i32, ptr %mcdc.addr, align 4 +// MCDC-DAG: %[[TEMP0:mcdc.temp[0-9]*]] = load i32, ptr %mcdc.addr, align 4 +// MCDC: %[[TEMP:[0-9]+]] = add i32 %[[TEMP0]], 0 // MCDC: %[[LAB1:[0-9]+]] = lshr i32 %[[TEMP]], 3 // MCDC: %[[LAB4:[0-9]+]] = getelementptr inbounds i8, ptr @__profbm_test, i32 %[[LAB1]] // MCDC: %[[LAB5:[0-9]+]] = and i32 %[[TEMP]], 7 diff --git a/clang/test/Profile/c-mcdc.c b/clang/test/Profile/c-mcdc.c index 823160329b31f..251c18baa861d 100644 --- a/clang/test/Profile/c-mcdc.c +++ b/clang/test/Profile/c-mcdc.c @@ -11,85 +11,80 @@ int test(int a, int b, int c, int d, int e, int f) { // NOPROFPASS-NOT: __profbm_test // MCDC BOOKKEEPING. -// MCDC: @__profbm_test = private global [8 x i8] zeroinitializer +// MCDC: @__profbm_test = private global [2 x i8] zeroinitializer // MCDC: @__profc_test = private global [9 x i64] zeroinitializer // ALLOCATE MCDC TEMP AND ZERO IT. // NOPROFPASS-LABEL: @test( -// NOPROFPASS: call void @llvm.instrprof.mcdc.parameters(ptr @__profn_test, i64 [[HASH:[0-9]+]], i32 8) +// NOPROFPASS: call void @llvm.instrprof.mcdc.parameters(ptr @__profn_test, i64 [[HASH:[0-9]+]], i32 15) // MCDC-LABEL: @test( // MCDC: %mcdc.addr = alloca i32, align 4 // MCDC: store i32 0, ptr %mcdc.addr, align 4 // SHIFT FIRST CONDITION WITH ID = 0. -// NOPROFPASS: call void @llvm.instrprof.mcdc.condbitmap.update(ptr @__profn_test, i64 [[HASH]], i32 0, ptr %mcdc.addr, i1 %tobool{{[0-9]*}}) // MCDC: %[[LAB1:[0-9]+]] = load i32, ptr %a.addr, align 4 // MCDC-DAG: %[[BOOL:tobool[0-9]*]] = icmp ne i32 %[[LAB1]], 0 -// MCDC-DAG: %[[TEMP:mcdc.temp[0-9]*]] = load i32, ptr %mcdc.addr, align 4 -// MCDC-DAG: %[[LAB2:[0-9]+]] = zext i1 %[[BOOL]] to i32 -// MCDC-DAG: %[[LAB3:[0-9]+]] = shl i32 %[[LAB2]], 0 -// MCDC-DAG: %[[LAB4:[0-9]+]] = or i32 %[[TEMP]], %[[LAB3]] +// MCDC-DAG: %[[TEMP:mcdc.*]] = load i32, ptr %mcdc.addr, align 4 +// MCDC-DAG: %[[LAB2:[0-9]+]] = add i32 %[[TEMP]], 0 +// MCDC-DAG: %[[LAB3:[0-9]+]] = add i32 %[[TEMP]], 0 +// MCDC-DAG: %[[LAB4:[0-9]+]] = select i1 %[[BOOL]], i32 %[[LAB2]], i32 %[[LAB3]] // MCDC-DAG: store i32 %[[LAB4]], ptr %mcdc.addr, align 4 // SHIFT SECOND CONDITION WITH ID = 2. // NOPROFPASS-LABEL: land.lhs.true: -// NOPROFPASS: call void @llvm.instrprof.mcdc.condbitmap.update(ptr @__profn_test, i64 [[HASH]], i32 2, ptr %mcdc.addr, i1 %tobool{{[0-9]*}}) // MCDC: %[[LAB1:[0-9]+]] = load i32, ptr %b.addr, align 4 // MCDC-DAG: %[[BOOL:tobool[0-9]*]] = icmp ne i32 %[[LAB1]], 0 -// MCDC-DAG: %[[TEMP:mcdc.temp[0-9]*]] = load i32, ptr %mcdc.addr, align 4 -// MCDC-DAG: %[[LAB2:[0-9]+]] = zext i1 %[[BOOL]] to i32 -// MCDC-DAG: %[[LAB3:[0-9]+]] = shl i32 %[[LAB2]], 2 -// MCDC-DAG: %[[LAB4:[0-9]+]] = or i32 %[[TEMP]], %[[LAB3]] +// MCDC-DAG: %[[TEMP:mcdc.*]] = load i32, ptr %mcdc.addr, align 4 +// MCDC-DAG: %[[LAB2:[0-9]+]] = add i32 %[[TEMP]], 14 +// MCDC-DAG: %[[LAB3:[0-9]+]] = add i32 %[[TEMP]], 1 +// MCDC-DAG: %[[LAB4:[0-9]+]] = select i1 %[[BOOL]], i32 %[[LAB2]], i32 %[[LAB3]] // MCDC-DAG: store i32 %[[LAB4]], ptr %mcdc.addr, align 4 // SHIFT THIRD CONDITION WITH ID = 1. // NOPROFPASS-LABEL: lor.rhs: -// NOPROFPASS: call void @llvm.instrprof.mcdc.condbitmap.update(ptr @__profn_test, i64 [[HASH]], i32 1, ptr %mcdc.addr, i1 %tobool{{[0-9]*}}) // MCDC: %[[LAB1:[0-9]+]] = load i32, ptr %c.addr, align 4 // MCDC-DAG: %[[BOOL:tobool[0-9]*]] = icmp ne i32 %[[LAB1]], 0 -// MCDC-DAG: %[[TEMP:mcdc.temp[0-9]*]] = load i32, ptr %mcdc.addr, align 4 -// MCDC-DAG: %[[LAB2:[0-9]+]] = zext i1 %[[BOOL]] to i32 -// MCDC-DAG: %[[LAB3:[0-9]+]] = shl i32 %[[LAB2]], 1 -// MCDC-DAG: %[[LAB4:[0-9]+]] = or i32 %[[TEMP]], %[[LAB3]] +// MCDC-DAG: %[[TEMP:mcdc.*]] = load i32, ptr %mcdc.addr, align 4 +// MCDC-DAG: %[[LAB2:[0-9]+]] = add i32 %[[TEMP]], 0 +// MCDC-DAG: %[[LAB3:[0-9]+]] = add i32 %[[TEMP]], 0 +// MCDC-DAG: %[[LAB4:[0-9]+]] = select i1 %[[BOOL]], i32 %[[LAB2]], i32 %[[LAB3]] // MCDC-DAG: store i32 %[[LAB4]], ptr %mcdc.addr, align 4 // SHIFT FOURTH CONDITION WITH ID = 4. // NOPROFPASS-LABEL: land.lhs.true3: -// NOPROFPASS: call void @llvm.instrprof.mcdc.condbitmap.update(ptr @__profn_test, i64 [[HASH]], i32 4, ptr %mcdc.addr, i1 %tobool{{[0-9]*}}) // MCDC: %[[LAB1:[0-9]+]] = load i32, ptr %d.addr, align 4 // MCDC-DAG: %[[BOOL:tobool[0-9]*]] = icmp ne i32 %[[LAB1]], 0 -// MCDC-DAG: %[[TEMP:mcdc.temp[0-9]*]] = load i32, ptr %mcdc.addr, align 4 -// MCDC-DAG: %[[LAB2:[0-9]+]] = zext i1 %[[BOOL]] to i32 -// MCDC-DAG: %[[LAB3:[0-9]+]] = shl i32 %[[LAB2]], 4 -// MCDC-DAG: %[[LAB4:[0-9]+]] = or i32 %[[TEMP]], %[[LAB3]] +// MCDC-DAG: %[[TEMP:mcdc.*]] = load i32, ptr %mcdc.addr, align 4 +// MCDC-DAG: %[[LAB2:[0-9]+]] = add i32 %[[TEMP]], 12 +// MCDC-DAG: %[[LAB3:[0-9]+]] = add i32 %[[TEMP]], 2 +// MCDC-DAG: %[[LAB4:[0-9]+]] = select i1 %[[BOOL]], i32 %[[LAB2]], i32 %[[LAB3]] // MCDC-DAG: store i32 %[[LAB4]], ptr %mcdc.addr, align 4 // SHIFT FIFTH CONDITION WITH ID = 3. // NOPROFPASS-LABEL: lor.rhs6: -// NOPROFPASS: call void @llvm.instrprof.mcdc.condbitmap.update(ptr @__profn_test, i64 [[HASH]], i32 3, ptr %mcdc.addr, i1 %tobool{{[0-9]*}}) // MCDC: %[[LAB1:[0-9]+]] = load i32, ptr %e.addr, align 4 // MCDC-DAG: %[[BOOL:tobool[0-9]*]] = icmp ne i32 %[[LAB1]], 0 -// MCDC-DAG: %[[TEMP:mcdc.temp[0-9]*]] = load i32, ptr %mcdc.addr, align 4 -// MCDC-DAG: %[[LAB2:[0-9]+]] = zext i1 %[[BOOL]] to i32 -// MCDC-DAG: %[[LAB3:[0-9]+]] = shl i32 %[[LAB2]], 3 -// MCDC-DAG: %[[LAB4:[0-9]+]] = or i32 %[[TEMP]], %[[LAB3]] +// MCDC-DAG: %[[TEMP:mcdc.*]] = load i32, ptr %mcdc.addr, align 4 +// MCDC-DAG: %[[LAB2:[0-9]+]] = add i32 %[[TEMP]], 0 +// MCDC-DAG: %[[LAB3:[0-9]+]] = add i32 %[[TEMP]], 0 +// MCDC-DAG: %[[LAB4:[0-9]+]] = select i1 %[[BOOL]], i32 %[[LAB2]], i32 %[[LAB3]] // MCDC-DAG: store i32 %[[LAB4]], ptr %mcdc.addr, align 4 // SHIFT SIXTH CONDITION WITH ID = 5. // NOPROFPASS-LABEL: land.rhs: -// NOPROFPASS: call void @llvm.instrprof.mcdc.condbitmap.update(ptr @__profn_test, i64 [[HASH]], i32 5, ptr %mcdc.addr, i1 %tobool{{[0-9]*}}) // MCDC: %[[LAB1:[0-9]+]] = load i32, ptr %f.addr, align 4 // MCDC-DAG: %[[BOOL:tobool[0-9]*]] = icmp ne i32 %[[LAB1]], 0 -// MCDC-DAG: %[[TEMP:mcdc.temp[0-9]*]] = load i32, ptr %mcdc.addr, align 4 -// MCDC-DAG: %[[LAB2:[0-9]+]] = zext i1 %[[BOOL]] to i32 -// MCDC-DAG: %[[LAB3:[0-9]+]] = shl i32 %[[LAB2]], 5 -// MCDC-DAG: %[[LAB4:[0-9]+]] = or i32 %[[TEMP]], %[[LAB3]] +// MCDC-DAG: %[[TEMP:mcdc.*]] = load i32, ptr %mcdc.addr, align 4 +// MCDC-DAG: %[[LAB2:[0-9]+]] = add i32 %[[TEMP]], 8 +// MCDC-DAG: %[[LAB3:[0-9]+]] = add i32 %[[TEMP]], 4 +// MCDC-DAG: %[[LAB4:[0-9]+]] = select i1 %[[BOOL]], i32 %[[LAB2]], i32 %[[LAB3]] // MCDC-DAG: store i32 %[[LAB4]], ptr %mcdc.addr, align 4 // UPDATE FINAL BITMASK WITH RESULT. // NOPROFPASS-LABEL: lor.end: -// NOPROFPASS: call void @llvm.instrprof.mcdc.tvbitmap.update(ptr @__profn_test, i64 [[HASH]], i32 8, i32 0, ptr %mcdc.addr) -// MCDC-DAG: %[[TEMP:mcdc.temp[0-9]*]] = load i32, ptr %mcdc.addr, align 4 +// NOPROFPASS: call void @llvm.instrprof.mcdc.tvbitmap.update(ptr @__profn_test, i64 [[HASH]], i32 0, i32 0, ptr %mcdc.addr) +// MCDC-DAG: %[[TEMP0:mcdc.temp[0-9]*]] = load i32, ptr %mcdc.addr, align 4 +// MCDC: %[[TEMP:[0-9]+]] = add i32 %[[TEMP0]], 0 // MCDC: %[[LAB1:[0-9]+]] = lshr i32 %[[TEMP]], 3 // MCDC: %[[LAB4:[0-9]+]] = getelementptr inbounds i8, ptr @__profbm_test, i32 %[[LAB1]] // MCDC: %[[LAB5:[0-9]+]] = and i32 %[[TEMP]], 7 diff --git a/compiler-rt/test/profile/ContinuousSyncMode/image-with-mcdc.c b/compiler-rt/test/profile/ContinuousSyncMode/image-with-mcdc.c index 748af46ee52fa..d2afe7048f37f 100644 --- a/compiler-rt/test/profile/ContinuousSyncMode/image-with-mcdc.c +++ b/compiler-rt/test/profile/ContinuousSyncMode/image-with-mcdc.c @@ -7,7 +7,7 @@ // CHECK: Num Bitmap Bytes: // CHECK-NEXT: $1 // CHECK-NEXT: Bitmap Byte Values: -// CHECK-NEXT: 8 +// CHECK-NEXT: 0x4 #include #include extern int __llvm_profile_is_continuous_mode_enabled(void); diff --git a/llvm/docs/CoverageMappingFormat.rst b/llvm/docs/CoverageMappingFormat.rst index f2ae8df5ad7f8..96bdf8fa71be7 100644 --- a/llvm/docs/CoverageMappingFormat.rst +++ b/llvm/docs/CoverageMappingFormat.rst @@ -148,7 +148,7 @@ There are several kinds of mapping regions: * Decision regions associate multiple branch regions with a boolean expression in the source code. This information also includes the number of - bitmap bytes needed to represent the expression's executed test vectors as + bitmap bits needed to represent the expression's executed test vectors as well as the total number of instrumentable branch conditions that comprise the expression. Decision regions are used to visualize Modified Condition/Decision Coverage (MC/DC) in *llvm-cov* for each boolean diff --git a/llvm/docs/LangRef.rst b/llvm/docs/LangRef.rst index f39b8dc6c90d4..10d53bea149ef 100644 --- a/llvm/docs/LangRef.rst +++ b/llvm/docs/LangRef.rst @@ -14411,7 +14411,7 @@ Syntax: :: declare void @llvm.instrprof.mcdc.parameters(ptr , i64 , - i32 ) + i32 ) Overview: """"""""" @@ -14429,7 +14429,7 @@ name of the entity being instrumented. This should generally be the The second argument is a hash value that can be used by the consumer of the profile data to detect changes to the instrumented source. -The third argument is the number of bitmap bytes required by the function to +The third argument is the number of bitmap bits required by the function to record the number of test vectors executed for each boolean expression. Semantics: @@ -14496,7 +14496,7 @@ Syntax: :: declare void @llvm.instrprof.mcdc.tvbitmap.update(ptr , i64 , - i32 ) + i32 ) i32 , ptr ) @@ -14506,10 +14506,9 @@ Overview: The '``llvm.instrprof.mcdc.tvbitmap.update``' intrinsic is used to track MC/DC test vector execution after each boolean expression has been fully executed. The overall value of the condition bitmap, after it has been successively -updated using the '``llvm.instrprof.mcdc.condbitmap.update``' intrinsic with -the true or false evaluation of each condition, uniquely identifies an executed -MC/DC test vector and is used as a bit index into the global test vector -bitmap. +updated with the true or false evaluation of each condition, uniquely identifies +an executed MC/DC test vector and is used as a bit index into the global test +vector bitmap. Arguments: """""""""" @@ -14521,10 +14520,9 @@ name of the entity being instrumented. This should generally be the The second argument is a hash value that can be used by the consumer of the profile data to detect changes to the instrumented source. -The third argument is the number of bitmap bytes required by the function to -record the number of test vectors executed for each boolean expression. +The third argument is not used. -The fourth argument is the byte index into the global test vector bitmap +The fourth argument is the bit index into the global test vector bitmap corresponding to the function. The fifth argument is the address of the condition bitmap, which contains a diff --git a/llvm/include/llvm/IR/IntrinsicInst.h b/llvm/include/llvm/IR/IntrinsicInst.h index 9010e1a1c896b..1ac4a5fffb43b 100644 --- a/llvm/include/llvm/IR/IntrinsicInst.h +++ b/llvm/include/llvm/IR/IntrinsicInst.h @@ -33,6 +33,7 @@ #include "llvm/IR/Intrinsics.h" #include "llvm/IR/Value.h" #include "llvm/Support/Casting.h" +#include "llvm/Support/MathExtras.h" #include #include #include @@ -1580,11 +1581,17 @@ class InstrProfMCDCBitmapInstBase : public InstrProfInstBase { return isa(V) && classof(cast(V)); } - /// \return The number of bytes used for the MCDC bitmaps for the instrumented + /// \return The number of bits used for the MCDC bitmaps for the instrumented /// function. - ConstantInt *getNumBitmapBytes() const { + ConstantInt *getNumBitmapBits() const { return cast(const_cast(getArgOperand(2))); } + + /// \return The number of bytes used for the MCDC bitmaps for the instrumented + /// function. + auto getNumBitmapBytes() const { + return alignTo(getNumBitmapBits()->getZExtValue(), CHAR_BIT) / CHAR_BIT; + } }; /// This represents the llvm.instrprof.mcdc.parameters intrinsic. diff --git a/llvm/include/llvm/ProfileData/Coverage/CoverageMapping.h b/llvm/include/llvm/ProfileData/Coverage/CoverageMapping.h index da03104045249..5fc497db8df54 100644 --- a/llvm/include/llvm/ProfileData/Coverage/CoverageMapping.h +++ b/llvm/include/llvm/ProfileData/Coverage/CoverageMapping.h @@ -677,7 +677,8 @@ class CounterMappingContext { /// pairs. Expected evaluateMCDCRegion(const CounterMappingRegion &Region, - ArrayRef Branches); + ArrayRef Branches, + bool IsVersion11); unsigned getMaxCounterID(const Counter &C) const; }; diff --git a/llvm/include/llvm/ProfileData/InstrProf.h b/llvm/include/llvm/ProfileData/InstrProf.h index 5cd8c3283373e..0c899e6d84965 100644 --- a/llvm/include/llvm/ProfileData/InstrProf.h +++ b/llvm/include/llvm/ProfileData/InstrProf.h @@ -1161,7 +1161,7 @@ enum ProfVersion { Version10 = 10, // An additional field is used for bitmap bytes. Version11 = 11, - // VTable profiling, + // VTable profiling, decision record and bitmap are modified for mcdc. Version12 = 12, // The current version is 12. CurrentVersion = INSTR_PROF_INDEX_VERSION diff --git a/llvm/lib/ProfileData/Coverage/CoverageMapping.cpp b/llvm/lib/ProfileData/Coverage/CoverageMapping.cpp index 8c81bbe8e9c4e..455124efd5b24 100644 --- a/llvm/lib/ProfileData/Coverage/CoverageMapping.cpp +++ b/llvm/lib/ProfileData/Coverage/CoverageMapping.cpp @@ -384,15 +384,18 @@ class MCDCRecordProcessor : NextIDsBuilder, mcdc::TVIdxBuilder { DenseSet TVIdxs; #endif + bool IsVersion11; + public: MCDCRecordProcessor(const BitVector &Bitmap, const CounterMappingRegion &Region, - ArrayRef Branches) + ArrayRef Branches, + bool IsVersion11) : NextIDsBuilder(Branches), TVIdxBuilder(this->NextIDs), Bitmap(Bitmap), Region(Region), DecisionParams(Region.getDecisionParams()), Branches(Branches), NumConditions(DecisionParams.NumConditions), Folded(NumConditions, false), IndependencePairs(NumConditions), - ExecVectors(ExecVectorsByCond[false]) {} + ExecVectors(ExecVectorsByCond[false]), IsVersion11(IsVersion11) {} private: // Walk the binary decision diagram and try assigning both false and true to @@ -415,7 +418,9 @@ class MCDCRecordProcessor : NextIDsBuilder, mcdc::TVIdxBuilder { assert(TVIdx < SavedNodes[ID].Width); assert(TVIdxs.insert(NextTVIdx).second && "Duplicate TVIdx"); - if (!Bitmap[DecisionParams.BitmapIdx * CHAR_BIT + TV.getIndex()]) + if (!Bitmap[IsVersion11 + ? DecisionParams.BitmapIdx * CHAR_BIT + TV.getIndex() + : DecisionParams.BitmapIdx - NumTestVectors + NextTVIdx]) continue; // Copy the completed test vector to the vector of testvectors. @@ -521,9 +526,9 @@ class MCDCRecordProcessor : NextIDsBuilder, mcdc::TVIdxBuilder { Expected CounterMappingContext::evaluateMCDCRegion( const CounterMappingRegion &Region, - ArrayRef Branches) { + ArrayRef Branches, bool IsVersion11) { - MCDCRecordProcessor MCDCProcessor(Bitmap, Region, Branches); + MCDCRecordProcessor MCDCProcessor(Bitmap, Region, Branches, IsVersion11); return MCDCProcessor.processMCDCRecord(); } @@ -610,8 +615,8 @@ static unsigned getMaxCounterID(const CounterMappingContext &Ctx, } /// Returns the bit count -static unsigned getMaxBitmapSize(const CounterMappingContext &Ctx, - const CoverageMappingRecord &Record) { +static unsigned getMaxBitmapSize(const CoverageMappingRecord &Record, + bool IsVersion11) { unsigned MaxBitmapIdx = 0; unsigned NumConditions = 0; // Scan max(BitmapIdx). @@ -626,8 +631,12 @@ static unsigned getMaxBitmapSize(const CounterMappingContext &Ctx, NumConditions = DecisionParams.NumConditions; } } - unsigned SizeInBits = llvm::alignTo(uint64_t(1) << NumConditions, CHAR_BIT); - return MaxBitmapIdx * CHAR_BIT + SizeInBits; + + if (IsVersion11) + MaxBitmapIdx = MaxBitmapIdx * CHAR_BIT + + llvm::alignTo(uint64_t(1) << NumConditions, CHAR_BIT); + + return MaxBitmapIdx; } namespace { @@ -815,6 +824,9 @@ Error CoverageMapping::loadFunctionRecord( } Ctx.setCounts(Counts); + bool IsVersion11 = + ProfileReader.getVersion() < IndexedInstrProf::ProfVersion::Version12; + BitVector Bitmap; if (Error E = ProfileReader.getFunctionBitmap(Record.FunctionName, Record.FunctionHash, Bitmap)) { @@ -826,7 +838,7 @@ Error CoverageMapping::loadFunctionRecord( } if (IPE != instrprof_error::unknown_function) return make_error(IPE); - Bitmap = BitVector(getMaxBitmapSize(Ctx, Record)); + Bitmap = BitVector(getMaxBitmapSize(Record, IsVersion11)); } Ctx.setBitmap(std::move(Bitmap)); @@ -884,7 +896,7 @@ Error CoverageMapping::loadFunctionRecord( // DecisionRegion, all of the information is now available to process. // This is where the bulk of the MC/DC progressing takes place. Expected Record = - Ctx.evaluateMCDCRegion(*MCDCDecision, MCDCBranches); + Ctx.evaluateMCDCRegion(*MCDCDecision, MCDCBranches, IsVersion11); if (auto E = Record.takeError()) { consumeError(std::move(E)); return Error::success(); diff --git a/llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp b/llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp index f9b58d9f27821..0c79eaa812b5f 100644 --- a/llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp +++ b/llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp @@ -936,9 +936,6 @@ Value *InstrLowerer::getBitmapAddress(InstrProfMCDCTVBitmapUpdate *I) { auto *Bitmaps = getOrCreateRegionBitmaps(I); IRBuilder<> Builder(I); - auto *Addr = Builder.CreateConstInBoundsGEP2_32( - Bitmaps->getValueType(), Bitmaps, 0, I->getBitmapIndex()->getZExtValue()); - if (isRuntimeCounterRelocationEnabled()) { LLVMContext &Ctx = M.getContext(); Ctx.diagnose(DiagnosticInfoPGOProfile( @@ -948,7 +945,7 @@ Value *InstrLowerer::getBitmapAddress(InstrProfMCDCTVBitmapUpdate *I) { DS_Warning)); } - return Addr; + return Bitmaps; } void InstrLowerer::lowerCover(InstrProfCoverInst *CoverInstruction) { @@ -1018,9 +1015,11 @@ void InstrLowerer::lowerMCDCTestVectorBitmapUpdate( auto *MCDCCondBitmapAddr = Update->getMCDCCondBitmapAddr(); auto *BitmapAddr = getBitmapAddress(Update); - // Load Temp Val. + // Load Temp Val + BitmapIdx. // %mcdc.temp = load i32, ptr %mcdc.addr, align 4 - auto *Temp = Builder.CreateLoad(Int32Ty, MCDCCondBitmapAddr, "mcdc.temp"); + auto *Temp = Builder.CreateAdd( + Builder.CreateLoad(Int32Ty, MCDCCondBitmapAddr, "mcdc.temp"), + Update->getBitmapIndex()); // Calculate byte offset using div8. // %1 = lshr i32 %mcdc.temp, 3 @@ -1415,7 +1414,7 @@ GlobalVariable * InstrLowerer::createRegionBitmaps(InstrProfMCDCBitmapInstBase *Inc, StringRef Name, GlobalValue::LinkageTypes Linkage) { - uint64_t NumBytes = Inc->getNumBitmapBytes()->getZExtValue(); + uint64_t NumBytes = Inc->getNumBitmapBytes(); auto *BitmapTy = ArrayType::get(Type::getInt8Ty(M.getContext()), NumBytes); auto GV = new GlobalVariable(M, BitmapTy, false, Linkage, Constant::getNullValue(BitmapTy), Name); @@ -1434,7 +1433,7 @@ InstrLowerer::getOrCreateRegionBitmaps(InstrProfMCDCBitmapInstBase *Inc) { // the corresponding profile section. auto *BitmapPtr = setupProfileSection(Inc, IPSK_bitmap); PD.RegionBitmaps = BitmapPtr; - PD.NumBitmapBytes = Inc->getNumBitmapBytes()->getZExtValue(); + PD.NumBitmapBytes = Inc->getNumBitmapBytes(); return PD.RegionBitmaps; } diff --git a/llvm/test/Instrumentation/InstrProfiling/inline-data-var-create.ll b/llvm/test/Instrumentation/InstrProfiling/inline-data-var-create.ll index 7c064f547141f..456103164378e 100644 --- a/llvm/test/Instrumentation/InstrProfiling/inline-data-var-create.ll +++ b/llvm/test/Instrumentation/InstrProfiling/inline-data-var-create.ll @@ -27,21 +27,21 @@ declare void @llvm.instrprof.mcdc.parameters(ptr %0, i64 %1, i32 %2) define internal void @foobar() { call void @llvm.instrprof.increment(ptr @__profn_foobar, i64 123456, i32 32, i32 0) - call void @llvm.instrprof.mcdc.parameters(ptr @__profn_foobar, i64 123456, i32 99) + call void @llvm.instrprof.mcdc.parameters(ptr @__profn_foobar, i64 123456, i32 792) ret void } define void @foo() { call void @llvm.instrprof.increment(ptr @__profn_foo, i64 123456, i32 32, i32 0) - call void @llvm.instrprof.mcdc.parameters(ptr @__profn_foo, i64 123456, i32 21) + call void @llvm.instrprof.mcdc.parameters(ptr @__profn_foo, i64 123456, i32 168) call void @foobar() ret void } define void @bar() { call void @llvm.instrprof.increment(ptr @__profn_bar, i64 123456, i32 32, i32 0) - call void @llvm.instrprof.mcdc.parameters(ptr @__profn_bar, i64 123456, i32 23) + call void @llvm.instrprof.mcdc.parameters(ptr @__profn_bar, i64 123456, i32 184) call void @foobar() ret void } diff --git a/llvm/test/Instrumentation/InstrProfiling/mcdc.ll b/llvm/test/Instrumentation/InstrProfiling/mcdc.ll index a7f1e606e35fa..e9ae80891ea6e 100644 --- a/llvm/test/Instrumentation/InstrProfiling/mcdc.ll +++ b/llvm/test/Instrumentation/InstrProfiling/mcdc.ll @@ -30,7 +30,8 @@ entry: ; CHECK-NEXT: store i32 %[[LAB3]], ptr %mcdc.addr, align 4 call void @llvm.instrprof.mcdc.tvbitmap.update(ptr @__profn_test, i64 99278, i32 1, i32 0, ptr %mcdc.addr) - ; CHECK: %[[TEMP:mcdc.*]] = load i32, ptr %mcdc.addr, align 4 + ; CHECK: %[[TEMP0:mcdc.*]] = load i32, ptr %mcdc.addr, align 4 + ; CHECK-NEXT: %[[TEMP:[0-9]+]] = add i32 %[[TEMP0]], 0 ; CHECK-NEXT: %[[LAB4:[0-9]+]] = lshr i32 %[[TEMP]], 3 ; CHECK-NEXT: %[[LAB7:[0-9]+]] = getelementptr inbounds i8, ptr @__profbm_test, i32 %[[LAB4]] ; CHECK-NEXT: %[[LAB8:[0-9]+]] = and i32 %[[TEMP]], 7 diff --git a/llvm/test/tools/llvm-cov/Inputs/mcdc-const-folding.o b/llvm/test/tools/llvm-cov/Inputs/mcdc-const-folding.o index 4f54fa7b8a1a1492a9a455bbf6fa651844345c59..7a16162f29c00777d9a05f5fed1cc4cbf333c56c 100644 GIT binary patch delta 5899 zcmai04Qx}_74|hDF*Lz(34QTOe!MP_Zf1!EB!NI3^V208h=$*kUq2ece}2FTA!&#M zH4AGy)jC3}v@*q-rh(Q;F-g~IQmY_3+D@BV5TmH9T0C_t6J;YJqNS~tedqeVC}BCqJF|7qV=1TLsie*3uUQLzlcw{l@_=AhRzH6yQs-f z9_GydABzD*`|Pvl;x{susvn=yFEB^zc$IdFrR7XV>(YJi^ov{bN!Sazzsm9rjkiKo z7r7TI9A6NxBxmwU;&$GGN$a1;9G_n9Q!0sGnc|$G$fxeJb`gcs3esgm?DUH%tGmY= z^EGAh*5<49I95B>nw?S_nlQ27<9l~6H0e;Fe_th?7g%??Z-(sE_#AXJZH_&zTFLl$ zD<4d@a!hadKhxIdl&Rcs79TJBr4`?D+PL-EXxp4*P$YvmXa2aX<-AB9QI#6G;XFO$ zJdMmy?pc1Gqm_FxB1N3nD9u$c<2iHiP)O+#ktPAO3wBXH`GD zkc&iD>n2s5Cgr{^UC}HRJ5;DAeYO|7@v5l0@^O`8DJxcwT~bVhRY@w)JBwaVH|9(} zCo6sTBDVw1)0bBI#v(T`cq^$zchXC#bgE;CzQ)OW`PJ0Gptiv)dh02evH1Va7r64# z3P%wQWjt0Ixt(%c#;5Szj@+nnp8j3G_5$f$LEmxAllx+$I>$UQg-$xwz+RJf&NLpk zNqb4!ho*C+LE7I;-zd^3>w(>{tBN_HWXzp23ku7u!xQ;4#R{60Ux{&T{#>z!j=~mEEWdKr zV%|es*|>*<9NLO#B!A|kYm$ycZYsoztpN6=iZ#)^0*}}{u%;mDbQP(jH`8sl2W@s+ z8I63`aPL#mGWFY`&_42%81A@=TDhePy+*Y_r>kkK+&`iJtXxGsB}PrHRkG6fp+ehK zoD1bEsN%m>@wLgYZIOy+QUY`3*^}WSh2Ba_&b5qOrG`7AP^$@N6nd2cKxa&uoV!M$ z^QooO=#D7VnpY_FeHFL1;RE=*Iu~%htV#w{yiCQd8lF?}NJ@N>ieF8}?Y5?YX}(|D zMGnR18}5RnIOeh0GI6V9TL~rR8)6B$78qg`TlW@?=~8SC?VaN-;2ht}!3hnCIv+&_N9?)Xq%H8fvC|4hDxhWJF<`(%PSRqZaX>k*CV zq$rpLbOE-6t-DfV7HiDqGy=3nL+1hgLal2(dCCm;4h>xZGzT|dO;iiCQ$rUaYW3te z^#J{G3OZY6+H9vO4m6g6^4{?E3MGKPuAz@1YAL@*u5v>ROZzbe%8kI?6sDz{Tv~jq7N1RV%;nY4%^F%p382*)Y67)-wUJzl4Y8d9u#If9 z!Wwf2buE6F!iyaOPZ=1$V(UJyF&dy{)%^xt26{z9>$N&QAW>t(h&9JSz?F~TX$Gv z9@cbvsTQ1wZ;Za#yXY-k>PZH#O9)RrLqD0Q4^!%I{)prMJoBH^hBu$EX(L zEOJ#DBA0snhC3hs=zMYC^eivM!K{$hPYEzrYRpH#wrX1^)wWOon!DM$+cc*B1`ksU z&{Gp$kxhb@Hx~2;iNeP(CcrX%*fjU%=@8T+3aqq4K!E z=MDsLTYYozF~Y@h{ry^)61QpyXz|C9WA&#t8K<`bE_YCIxWcH$X`&I--=-<(Z>f{y zS!TG;YN-B}dW~vWVuq4+Yxm+e3TE?%krwCAfhSNkGvYen9H z`^z$>iZT+_6CaQ)%NL9A-A6v4)(0e~^JSse$OLMAKn_W40Fa;av5i?N349r#MjSD=0K8s3mYqiemQmptqI z6x^6Yp>#M!aFOy;8tKydPO#Q zHUon<3a?#y!EL}cd+}`~F?gf!s>!nj^KA#V#Vh)yHw_i zi+3OauW&Ci8n~0pdqMJUQlbIKJ|Mfj&}UvByg_)^CGU>pL3q|qkm9R}Kr-xjbBucEp^#pqsC{D*~3pk;y6Fku^xFMd%!&Dpkij6 zkW8G+7#OG@wqNqv$vnZmioxEY1ngPzJi}uX_A|*jO9_lC$P@7kKbf#~6q7aqd!0Nd Nd0$LeygN?L{SRp}gY^Ia delta 6068 zcmai2dr(x@8Q*gSVHI6K;BrwBf|+1?Q(YBVFtTid5u!Fcd_Te?%0qmBg0dKetzsb6 z8OYb9WG0zNr)kr)X;@7<(SNc`G~&c*HBB;UO{daHGj@oRFt!X!?9ku2dk&m#)AY>T zZ_oYxzVrLO^WAgKy>RP{Hh4zs&SZl2Hnfh3rYOu2u?qM!L$$3(MT-1;?|$(BYqubyK)eF<7~GBrjfFFnV)20r|2bRrj(1KVfuJLU|$ z_igdWGc6%oXr4oWrZjOQe)3O_Hq8-zq!2Yc!x`|i;Rt`EGe9G(C^Cxo$*rZdeMhnp zAKr?#W;!*W$(a6#em=4L{xhy0YKYxDQ^3xv&OrFg&Y>jM*kyMe2O_CCa(>)H*GGCYQKB#8X405p5MI!q4aqn@1l_ zbGBIpat6+^@bs-GI@+8n#QhPFYK{%dMw59=RZfhXTnXP&Tv3_P=4FM6p(Vzv%=I&- zQceAinqnjtRC;V^(9}a9d*p^TS%Z$7j^{D2sU`P*!9s@(&%#=9)sDk~YR5N&cO7lk zeaFqFEHSzKXS4X4%y0i)bSH)s{%94yofNcyp0yHfzZwzB${IMlO$dd&Bc%5NyYyys zdisL0(59Qr;(f901kh$vkB@jP!qwxDZ-FE~Wb%R-1d z-xk7or{iY69tXp12gd-Lu2Pp}~ zAnWOu7JegjWul9(QM6cG0cLe=8I-N~tyC<-6+PNT|J$}AzL60LY zT@1Q3-DZooX||=5zF0S^1-e4~whHzoDgpb3Kr_Ve62V?4AJ_;HW~pF5#)-?7SCD_P zUbIHAGVU{itrhqhF{(n~ZwkCr;5hp!!nTtHIh1?pOc`!8Y8HbB|^HxcXVCzFS z7Mq0ry@^meLVZwp#VfBk;>jx~^Rd$aJQHaI_I_>+r&tGkUYUw#4yCWq4Y$HR1oj&-uXR)ccC*4R2b+M4 zw@UJXtykC_pfZPpp_icT~2!KagM!1i)$yrOvWQ&{HzD`G2k<6VW_rRZECC)iIE zmhW_#&*xORQZE_~W2N#x6}(Q-oKWxv1)og=h?Ojc^SbR<*!yS%>@tOI1}igpl+qv8 z*;*=r-OjC1qj(-tbPkXYK0flp_Hb+TDxR(I6t}k5Xb9|E3frRSd_ZxlboLQ>VE@8x z(HDwml;ZiNg5xDKd4~K$!TG+FD`YzLt(ZEms{3NEKg^TQDvTP zY*hT!6L=@}z^Bf#O_t}0|Ka%@4M68bg;mezpVA1}*A+HR$;xjjzoW2f4j)juTW5cy z64<|UTlAIUnW5JpwQM;x=Ht6W8MPRrWVH`aAJ`)byIf(9S(+y;&0b<2yuTDr{+%Lq0^|hy zd%^PT&nPV3Umm^aGi9s?tbEseuHfpadoK)^dm)7e5Ni=%f@nNeH!hipi$=h%QP}4c z_6L;yh;BS7Sb26y<#s9o+pUcKu`>1*@`3%0!oHxeZs8d)`M5`;A`M<*-uMB_8&8;D)#NPHjh8rtb~5xc$-Y6AV6O}G*I{e~^?+R=Ua=pA zv1@1mto*3F7skFxBVZX%0d1kskXgl3dJztH!LAEqTd1T+FS;z)rZ851RCb2pY2q+_ zDGbL)2Grz7<)tuIepG%MhRcu2FT?P?6!*B!E}UQVxFedqNI9izSTgxav+eE6LR0Og zfzoVNOTkh%+d?^IZq`6v*w?In3kA_1v-<7i-Qd;=?UY-VhZj^3H@%^oZt`w)YqzZ% z8Y@kpm`$eUngPdBI*o28@8;218JNwc{ZoD_qE(S+!&*8GB!8wv27ttDG3~ESBA$)# z0TL_DgDM&T60_B`w@f0QP4EG7YYHjLrm;b{a znLz6*5hk9-%kx+3m!| zU#DO-gm*!>#zZjhE(q7)$xZn-OJ5s#YazTF!nLMmOQ7-H5Uw-r(c&0E7JFSR!OCI@ z1?wPO1K~ZUR)K$J)s)h;J*K^O%K4~tt{`tclxv|}Z?XUdYs+ZeUei7(d^3sFO5bh@ z?uGCk2=6nsC5hC!2g2yO&^_+P9~Zp%0rKvLVm%c1o7&k#8m~vL2Qab3P!Tf8_mnH- ztbJWT;|KD{wGWyNrWTt-t^1(aVA_-UYZMI$RAp=VNtSjRc^jdCo$z9w%23Vg`a#t>w$o9UKQJ9(R+*a*cY6icV^MkqF; zSh|ewt9A+JehM~2@emXbo9sGy4?*#;seP(b>j5_o1|Iend5=J`35rLs2$E^M35qRP z1j$m7Rk?(7ECpMjco>Rall7DLFciJmCCSu!P%7q=w-t&}NKnTAyK z)w!5qg>RtXQ7C$$__V2Y8`SDWLDB6+x7jVc&XV^SBwHbQ3=1lS##eVE%Bm8zj-)g6>i2RYBepkZOn22~!KqrS$kDiuFBA>rR^X0RK2c xi?&wAU`V%{f+yW9nsPea%t77`x0X5I8g;!RlW%&!0m?bWOX`K~qzk7W_&3g0Q!xMl diff --git a/llvm/test/tools/llvm-cov/Inputs/mcdc-const-folding.proftext b/llvm/test/tools/llvm-cov/Inputs/mcdc-const-folding.proftext index 82335a8195faa..97d78a39f4356 100644 --- a/llvm/test/tools/llvm-cov/Inputs/mcdc-const-folding.proftext +++ b/llvm/test/tools/llvm-cov/Inputs/mcdc-const-folding.proftext @@ -40,7 +40,7 @@ _Z5case2b # Num Bitmap Bytes: $1 # Bitmap Byte Values: -0xa +0x6 _Z5case3b @@ -55,7 +55,7 @@ _Z5case3b # Num Bitmap Bytes: $1 # Bitmap Byte Values: -0x9 +0x5 _Z5case4b @@ -70,7 +70,7 @@ _Z5case4b # Num Bitmap Bytes: $1 # Bitmap Byte Values: -0x2 +0x1 _Z5case5b @@ -85,7 +85,7 @@ _Z5case5b # Num Bitmap Bytes: $1 # Bitmap Byte Values: -0x6 +0x5 _Z5case6b @@ -100,7 +100,7 @@ _Z5case6b # Num Bitmap Bytes: $1 # Bitmap Byte Values: -0x5 +0x6 _Z5case7b @@ -166,7 +166,7 @@ _Z5caseabb # Num Bitmap Bytes: $1 # Bitmap Byte Values: -0xa2 +0xe _Z5casebbb @@ -183,7 +183,7 @@ _Z5casebbb # Num Bitmap Bytes: $1 # Bitmap Byte Values: -0xa1 +0xd _Z5casecbb @@ -200,7 +200,7 @@ _Z5casecbb # Num Bitmap Bytes: $1 # Bitmap Byte Values: -0x2 +0x1 _Z5casedbb @@ -217,7 +217,7 @@ _Z5casedbb # Num Bitmap Bytes: $1 # Bitmap Byte Values: -0x12 +0x3 _Z5caseebb @@ -234,7 +234,7 @@ _Z5caseebb # Num Bitmap Bytes: $1 # Bitmap Byte Values: -0x14 +0xa _Z5casefbb @@ -251,7 +251,7 @@ _Z5casefbb # Num Bitmap Bytes: $1 # Bitmap Byte Values: -0x6 +0x9 _Z5casegbb @@ -268,7 +268,7 @@ _Z5casegbb # Num Bitmap Bytes: $1 # Bitmap Byte Values: -0x23 +0x7 _Z5casehbb @@ -302,7 +302,7 @@ _Z5caseibb # Num Bitmap Bytes: $1 # Bitmap Byte Values: -0x83 +0xb _Z5casejbb @@ -319,7 +319,7 @@ _Z5casejbb # Num Bitmap Bytes: $1 # Bitmap Byte Values: -0xa1 +0xd _Z5casekbb @@ -336,7 +336,7 @@ _Z5casekbb # Num Bitmap Bytes: $1 # Bitmap Byte Values: -0x12 +0x3 _Z5caselbb @@ -353,7 +353,7 @@ _Z5caselbb # Num Bitmap Bytes: $1 # Bitmap Byte Values: -0x12 +0x3 _Z5casembb @@ -370,7 +370,7 @@ _Z5casembb # Num Bitmap Bytes: $1 # Bitmap Byte Values: -0x12 +0x3 _Z5casenbb @@ -387,7 +387,7 @@ _Z5casenbb # Num Bitmap Bytes: $1 # Bitmap Byte Values: -0x6 +0x9 main diff --git a/llvm/test/tools/llvm-cov/Inputs/mcdc-const.o b/llvm/test/tools/llvm-cov/Inputs/mcdc-const.o index 1145fcc6f7125452262d0745b9de0591c1e48cda..bc38b71b5de072cedeb2172d160d6705d4855c47 100644 GIT binary patch delta 59 zcmcbiaYJK5A|uPhq;w#0%9@d7G8>}_khEqD2a=N+yBWDR%QHDLGBRyWWDe(HWSTsY LS$^{k{stBR?>Y~s delta 61 zcmcbiaYJK5A|unpq;w#0%9@dBG8>}_khEqD2a=N+yBQfa%QHDLPVV3p*j&Ku!NbTh Nc_Op?<{SJCEC3mc5Xk@l diff --git a/llvm/test/tools/llvm-cov/Inputs/mcdc-const.proftext b/llvm/test/tools/llvm-cov/Inputs/mcdc-const.proftext index 10253f26e0a68..16eba3a018080 100644 --- a/llvm/test/tools/llvm-cov/Inputs/mcdc-const.proftext +++ b/llvm/test/tools/llvm-cov/Inputs/mcdc-const.proftext @@ -14,12 +14,10 @@ _Z4testbbbb 0 0 # Num Bitmap Bytes: -$4 +$2 # Bitmap Byte Values: 0x1 -0x2 -0x0 -0x0 +0x4 main diff --git a/llvm/test/tools/llvm-cov/Inputs/mcdc-general-18.o b/llvm/test/tools/llvm-cov/Inputs/mcdc-general-18.o new file mode 100644 index 0000000000000000000000000000000000000000..e802f51132c068f0f4e2921c952710cb5c5665e5 GIT binary patch literal 6456 zcmd5=eQaA-6~FJjWU*VvcC)5U(xq}rH?p!k>?X~c(jYsHvs7eLwzAQ|z;zubjTV2% zd5H!L7F4%e5a~8hCH_Df|1qHN&o~k&z2nn6Lm{Z zC|`2!B`h8~_tr|&n}B?okPBBWG95Qwd)~P8d!JeLIE)^z;#c{y(@$`+Tyb`+r=+UP zu6#LEehzeKf2kD>%(d^rx4SlCt6&s5^&LRgc0w<_nDKK){L+=UZy=0b{s0Ob+^yVo z;H!qd?i`^tRPs}3!C1Wfmr(fy&(O<@J*{|U5VU?nySdHy7yV z>nnjI)|@O~caG97wB~MFHi|ud@+ZE}CBBeIeSQs$xhw0NHt5UH3R<YH`(dXikSd zxIn%+Fo~WU&3~*SolBJb$Id@^5hev&0)(NFzP|diT;!cyZicL#_(`rD49GQH8y>0vl%uFVHie>2pOV9?C2Fu z$PD2V{%EUdSSGGoMXLx#x7=hwY*_il&0>dNY!&U%_DyD!z*W2G6kXBIAV|1s7PlCu zmX?-$%|^4>T@B*HAg#Toi7eXFW{6fR=0~TH|Xs(L9sF;)Y}A=8L-C6hIip{1FKiVEjH@AR z#E?`;?!n4HB`H-7+gKT>>=R)($UY1LnE2;gD}NfCI(zwMnFS(ns#N(?-mnM>zqB8%CQ zw2ckfQ9C*_>)@2TWPIs9VLTExb_7~{PeC%{0N+A;a)cAX@JO&@Bp68qdlSLv$>uXn zPgsJQK5xEym1bxY1G*^qj6bo^JeEk+V_%h!P`f!PLWABhl0QhG3AmL9)5I!Lk zfcU2pdyaYYyy2csc%V0l_bNJ$GQROTeGLFZY_G!Hml;S5ah92<2=65e#=nY%K;(L4 z3I7JzlKPuA;0RdNPI%iLQa|7U%F2=*Qvh08vWvC&52YBc1*`hpX>WT~F5#uFLlzuc z^~kDrt#;QE+iC%jB2ZVG@?7N10sblY)XVZsz)_#|r(Uc(!mNaPIz9aj6G4ff(oK+wa0voZpcH3XV^i{Uj9}{qvK1P{ZY+3)sUNeh0}5 z3aucVLxXy{88yuh_f0#NBDCZ zUMBoS4d*$#py1da62%(|j`>WHpI<6CURk+6zaw1l&mR?ib*|piaDFcDE4bQ+7HlLC z_tTYx=u&VzZ#bVG1xG(0P=Gxe9w0}16&z0?_H#hN(GTk?;_}5l|htu6!ee#Na{YWRT=kD5APKo*(7TTXm;mHe~9gj|+SLi#f@$2};3JX(tWN3&`yZ+?NO4>g)mH{ncIY z6tiOhADTQIOGW81{m<+UICt>(R;N8QK#$Y8#QT~ke@7AXZZNK9oDBY|4i{iJ|0>-H z0%CC$g!QvH+(1|5{|AKVhBdn48xha(y$~GZ>o>h96~*rXs7PX&`Qw0Yygdrh+v4hT zJdBUGK+c~z-Zx}V%m}PJic@^P&+!iXW4TfMXr1_Y+vm8<8^u3Q3Vd(mczXP2U_<6F zBCI0$yJX*6gL?gExKaN5>*SBIIdA620K@qBx4%jq^xXBia&z@G8^w=Pe16XO{P3?9 zj>~)!uzK+$6#v^^D7n)6mjL5>_Ailr{6p*yg0aj+tN$sw=ts#O^T+d>HRAJfY@HoRIctLd;U9xx7nWg2yEb*=Y;jn zkbNfu#MzGd+ko?0RsEj+;%WA*`w!Q?sEx09mh6{UkvR8{;lIHGXCcl2@ptR=zYF%* vp8J0VFl(Yx0Ja35Dn-KXlK)eI?+=n*>i__H?x=Ty<~L58XovSsJ^p_HjJhJT literal 0 HcmV?d00001 diff --git a/llvm/test/tools/llvm-cov/Inputs/mcdc-general-18.profdata b/llvm/test/tools/llvm-cov/Inputs/mcdc-general-18.profdata new file mode 100644 index 0000000000000000000000000000000000000000..d351096967dbf315b7bedf94441be0f19a936ba3 GIT binary patch literal 888 zcmeyLQ&5zjmf6V7fE`3Iqly=x@!6o#0#KR>N{c{gb~Kt5$~T140_so(8nvK}5iA1J z58*K|IPgLo05b>XoClLx!0OS(8>ApEgvc^5z-Wbq5R+m0VfGwQ=LDOBE}pQC3oH)v zA1{~(Busg*iZ9p=Q2}!|EIdBc@qyK&iyKJuV-=6E!!CZu5xcmV6LxWX9O6t2zpnN^ zH%pm%8x}GeV0SPuPiEWlv_4U0G!4GUgLxCihtV*7umr6SbtlY= cFt0(92LnShRK5XC9h3_*4rV+9oB>e)05F*>P5=M^ literal 0 HcmV?d00001 diff --git a/llvm/test/tools/llvm-cov/Inputs/mcdc-general.o b/llvm/test/tools/llvm-cov/Inputs/mcdc-general.o index e802f51132c068f0f4e2921c952710cb5c5665e5..8bed601221a1459b613300a7386e5251a3fdce1d 100644 GIT binary patch delta 1809 zcmZ`(T}&KR6rMW^+u3DzW_Nb!>=@F5Az^Eq!ctoZsT~F-(zGU}HAd04s15YNR4`jZ z`T}hi!y2pLd9a%J!;?=YAhE)OmQ8u+)-`ph1?ix+X5q<2DEr-9cvo|`{$|aQSUv_pil^A>5kzJzXJyiPqwF zac$46r4NX^cInE6kbOQUXJ*r9V1U&QQc#P>^Woyl6Kr8I$P0~djV@Yd4hsmkp)fVU zmS#{p_n}lCt7yZQ5Ls%*Uj8=)LqenwpEt_~Db;`FZ>RgjJ@bQ>`Ei{J=}s$d_=U$P z?iQ&P?N#1okM?@LN4uL_(FVD_j;~{>+2X;_kdrEvUwTK9o{~cT4XKA#7%nL@d-`d& zmb3F28Eds?Zl{k4oEFzB?w`xq+`=zPB`~?BJ)0|Taf=j{P;f(f{!kOu3yTVGvg7=m z^1OY_K7RDd1j~Ns!o}a<8F{ys73rNNcf+{6_aPe5vCp}aI%YMj%8fp35_bBIvrX`} z?*t3Nim!=r&Xa`gZ@Bos?jkd0xR&iW%&!D z?cyQfw;yVPhIv$2F1th6y|5fG%u^+7nXpg8S&Tg+EJCT@duxuo0h2+4y+;|?hg^Tg zktv?@vWTLJ0X%m_)c4$Tk?TLm-@N1Tq=}vo_I-#}7-kv$6j9vHA9YMA0^`VTEn!~} zY#sC?yR(F)XCm1REM)9&5p3yPZ6#6e`y74%-UVYJgY}R$U-S6T)b6g%Qa@}2Qt0_U z_x!};NmIL3CLxD;zA9ngqP9`;@FKGFCF}`@lx{#x*hu{<*wVTF^h9}kyT^O;LBDFG zbXqft`)c>at8FX6R|UQcCc}o=;$dkP_pKj?pOHP_Vg1OuJ2}GHE)PqwwRlLn!B!1+ zlDaZad3?N`55qY6T;%#=DB%55%E`Xqv0wB2a}S99iAODyhEZ)G+UJzzlT%3jlo`3h z*g1&mPqKgDIlU=3O|?-P{P2OkhqXdMx8P7b4z;lz>=1OuESQfga52`*=AjU?f)f8z zlBA>rU9ml^13KeYASpl})cCi;bY(T%j5o6eh*nzcDs-a01!JhYp@3R}Xrd1O))Nph z6?k@Yb3maTq9|ZiHn9j4Hd}Hc0=lt}dN3^Z5{#k#2nwjb#BhsELubO0J0kFIVjmlT L0zv~2HS7KbEcK>Y delta 1785 zcmZ`(eP|PB7{B)}jk%cIrEQWoH^u1`P0IdgTDK1EdUvwS2-{e7NQZN!AhUHFqwF?> zF{qQKC{`&8RlTApewwyYWY-X6K0uQo_{M()}p|79-?SDnW=qEDW)3y~x4v=ie< zzK~$j`OcAx9I^Gu>xD>@T6SlhZjM>{U$uMp zo`bjKCz2|U3^5G=&nBGZI)j_RocK(_7Vv`RrV1Xlt2ejU~8b0 z1WE@39}*G-61)=4W8LxWQGXynoSlw^5*DewRSK{NB-2&w>B{?8rYP?*h*}(6w zLpDs|U^oKbg(GAb`cV6kpjFWSr&>EjC}O_juz>a}FZUVdXU__H75#s?{_-+-g~euN z_TlmPU3b>5l3Is9!*LyEB9u^=SV@ibb()vBW-Hu8HYc#GAKp&&IcSVfW0$}NkoBkQ z0UOy~fn~dNc;@|H^>?5zN{#oI(Tu_u*x^waM0*OdQM%)sI;FqavVgM=`Bl0o;H>&S zUi}Ibqm=x@IwZfdPWl!Er8wiFfQ$XF;J+C5VtW5PBH%Fu{cWs+ZjBl(0?V>Rcvu@8 zMs~|GtPK+yCEH<8r^X9{hSl|d8@pivH~C5(>wl@Yp;4#gh-V96W1gdeQtae2R%ORY zffcKi1YC?dE#Ttze();Zf*Jke#y9w^Ov;{QX)t!5kQNwd+D`t0iKdS53BJj>2DsDo zq|&NLFcC_C)tn}27-%+$1>5u*PViC9EotjBUuMuv*= z3+v5-f;5OtU-BVSdeNuMpo|{Uo}8lx5hUo3{m$K4UPeE-=bZ2Necw6XId>*@FV+`g zQ||sq(0{C{>qDw*wd;4on!`rbxt2cE-?pVW#}b8fNHoQilM;oSegU%3(BtBcLNGcl zdi9;F?mM@rmzlO_VRl|9oFMo`t|w8t9c9?racaeV)jYJ-{nMOR+#SUbU()-^kI4^^ z_g`~%-f1c`W(3yxJ*^6E3`kc{qSFP(7+bdpHc_}U=H8r^?bz~McjKJ)-QcAzG za9qg56rD&E+=CN6_S&AqAm5CLHu*Bk|GnU;)Y&t6I@GoO-ex}o{(Y?810r?82)hV1v^IN7friKyNhp0mE(6ysh&DjPpQG%_Fm~Ollnl_ z>r_ulb=IrF#?soRleCSSsDgYT-&xhkSEI&;Tg+>2MrejUuZ`Kp0B4meP>rdL8f?XO z8e@D6B)Er)r{>SSg9EDl_=MOaMevW^EbvKuzfp@`u&@=h{=HVLE0#Xrvr^zrgbFRt zTgKW2MvM|WSjL_f_!;-YOYEm{+#KI>J-ow7a(%M6BwGIxNxquwl7;1Y?g+es=gGTP z#`*j3}GAU#H4^frg>T(g<5||@p6ITYB%QR1grWF?|wSzax*aw2`we*jR>LKqHg{|nzTFlzt+ delta 1412 zcmZ8hOKcNY6!m-d7*FDi$Dc5ECEBElL;_aji4aNDD#J??b=nQkRuu7fRdrFJevlU| z5HXmbSgK2+t8`a^yMt~*LItd9OI2iV+5l2j6&6euRU#J&M8!w_xc83Vq$XE-_xap& z?&n>NJUzHPIMdH{eRf;V%O8k+@9inx5yhu=Q}Lk{|CunKOf^MhZYlTf?2%U{&B{n4 zGFK6$@g+UCU8>||){(ndErq8~M`UP0Y4n+u1~1muH4{_K$Xu1x)#}0~`hD&K_NlJ= zdu}bT+beddi~5EVA(^mB(AAyAAG7yfn>_wF@|io_$C1C>`*CE_z0JzhT`Zm3Eebyc zWV&5)skJgD%MkX;JDXl?mUp|dsRubts%|pOXmpwNhB{pnrSMXr+NwFZUP$hudS6j% zqPT=z`A8#o!0X)FpewpqsooEas}DySr(gen3i(!>)$Bq=5&7S7sPW>X+bbd6t5Ntd zbWj`-M-Q*zG_)m=-?A?AcJ+Qpu{|L?WdqCyDgF)m>s+t^Jm-Ta&$t|$F$^_)+4ljp=AonSAh%u^W1-j5$0G7!$|EX8Jefu z(Sp9CAUX{5ghU?OCvjmzJS_1QC}YiQ8`yxvH{lkt^$qMHiGPM_r@?*&6aA{|ACR6s zhis>jV)U7y(IkF6-iuV|4I6K7X=CZV=kSpAwZ%ITQ#M(qElzscDw%*s*z27(ma^pX zn)|3%>Wem(a*tCY+DX_OHrUs21~vFmxaRHc%NF!~4_8t119f4)frH95siYlsyH-{K~RPxPH?e+NluzRUU$%Y&m^ zY!^7)ao7<}vl+-nEoQs;8sZz^Al}pBV`+8?vN4O*pp1UM8~qcbe?V{CV#mNq#32_? zvxiVd{0toQm!LOcvCmy?E|FG;-9HBW4q+fZ#7<(4rP?w!50^3a46@x8TZS_FY0R_O zFgV6m2t|`L-)4&s2jScJDBl%?6})^JylRZ%Q?iD|W}%G!3MN?Ue6aP@85l?o@r(u^ PCP%SjIZ0DF$*unZ3}9jl diff --git a/llvm/test/tools/llvm-cov/Inputs/mcdc-macro.proftext b/llvm/test/tools/llvm-cov/Inputs/mcdc-macro.proftext index 35ecc42b5802a..44057ffd7d885 100644 --- a/llvm/test/tools/llvm-cov/Inputs/mcdc-macro.proftext +++ b/llvm/test/tools/llvm-cov/Inputs/mcdc-macro.proftext @@ -27,21 +27,12 @@ func 0 0 # Num Bitmap Bytes: -$13 +$4 # Bitmap Byte Values: 0x0 +0x9 0x0 -0x0 -0x20 -0x8 -0x0 -0x20 -0x0 -0x0 -0x0 -0x0 -0x0 -0x0 +0x1 func1 diff --git a/llvm/test/tools/llvm-cov/Inputs/mcdc-maxbs.o b/llvm/test/tools/llvm-cov/Inputs/mcdc-maxbs.o index bc993b19e84733fdf7670a5aec58219519837ec2..21f9d3a17dad0d1531e38ec1fbffb7dca3085535 100644 GIT binary patch delta 404 zcmbQBFhOBLc)h>Je^v${Xy65rEKuGKMj+=fM2yk!(oSX|*P|D#(BnTt=Y`Hw2VXHa zJY;v+#^`YAnMW^Jvjc|-7gP^Z^MA*p<50tPfedT@A6?A1lM`Xi>un%uFQ9!gyqJEAwSW!6P7*K(G~vg&3F^j!e#EJ;mPLziTslf_WE!#7A=Mee{23WFf2JB9DElSQPzJ*ThbJpAMl&)_u3-#fWY~P3QIL_5dGbT1#f(Qcw=!R5 z6g&!21_WDyScrj%;ppT{*7J<^lQ*)7Ge%Di1d{2KKeCE5mP~GB6PN4)t7QPHV_;wh zVjU=dGDyATDl}OWD1ZOthd|jANU}UY_MiU{aAmR}yEx;`$(ro*fsQ)K{+yBV!RC#e N|A7wOypcPe1pps?Vvqm; diff --git a/llvm/test/tools/llvm-cov/mcdc-general-18.test b/llvm/test/tools/llvm-cov/mcdc-general-18.test new file mode 100644 index 0000000000000..8707238c4cdcb --- /dev/null +++ b/llvm/test/tools/llvm-cov/mcdc-general-18.test @@ -0,0 +1,20 @@ +// Test Version11 (clang-18) files. +// mcdc-general.test is used as test patterns. + +// RUN: llvm-cov show --show-mcdc %S/Inputs/mcdc-general-18.o -instr-profile %S/Inputs/mcdc-general-18.profdata -path-equivalence=.,%S/Inputs | FileCheck %S/mcdc-general.test +// RUN: llvm-cov report --show-mcdc-summary %S/Inputs/mcdc-general-18.o -instr-profile %S/Inputs/mcdc-general-18.profdata -show-functions -path-equivalence=.,%S/Inputs %S/Inputs/mcdc-general.cpp | FileCheck %S/mcdc-general.test -check-prefix=REPORT + +// Turn off MC/DC visualization. +// RUN: llvm-cov show %S/Inputs/mcdc-general-18.o -instr-profile %S/Inputs/mcdc-general-18.profdata -path-equivalence=.,%S/Inputs | FileCheck %S/mcdc-general.test -check-prefix=NOMCDC + +// Turn off MC/DC summary. +// RUN: llvm-cov report %S/Inputs/mcdc-general-18.o -instr-profile %S/Inputs/mcdc-general-18.profdata -show-functions -path-equivalence=.,%S/Inputs %S/Inputs/mcdc-general.cpp | FileCheck %S/mcdc-general.test -check-prefix=REPORT_NOMCDC + +// Test file-level report. +// RUN: llvm-cov report --show-mcdc-summary %S/Inputs/mcdc-general-18.o -instr-profile %S/Inputs/mcdc-general-18.profdata -path-equivalence=.,%S/Inputs %S/Inputs/mcdc-general.cpp | FileCheck %S/mcdc-general.test -check-prefix=FILEREPORT + +// Test html output. +// RUN: rm -rf %t.html.dir +// RUN: llvm-cov show --show-mcdc-summary --show-mcdc %S/Inputs/mcdc-general-18.o -instr-profile %S/Inputs/mcdc-general-18.profdata -path-equivalence=.,%S/Inputs -format html -o %t.html.dir +// RUN: FileCheck -check-prefix=HTML -input-file=%t.html.dir/coverage/mcdc-general.cpp.html %S/mcdc-general.test +// RUN: FileCheck -check-prefix HTML-INDEX -input-file %t.html.dir/index.html %S/mcdc-general.test diff --git a/llvm/unittests/ProfileData/CoverageMappingTest.cpp b/llvm/unittests/ProfileData/CoverageMappingTest.cpp index f063a33205b30..ef147674591c5 100644 --- a/llvm/unittests/ProfileData/CoverageMappingTest.cpp +++ b/llvm/unittests/ProfileData/CoverageMappingTest.cpp @@ -872,7 +872,7 @@ TEST_P(CoverageMappingTest, non_code_region_bitmask) { addCMR(Counter::getCounter(2), "file", 1, 1, 5, 5); addCMR(Counter::getCounter(3), "file", 1, 1, 5, 5); - addMCDCDecisionCMR(0, 2, "file", 7, 1, 7, 6); + addMCDCDecisionCMR(3, 2, "file", 7, 1, 7, 6); addMCDCBranchCMR(Counter::getCounter(0), Counter::getCounter(1), 0, {-1, 1}, "file", 7, 2, 7, 3); addMCDCBranchCMR(Counter::getCounter(2), Counter::getCounter(3), 1, {-1, -1}, @@ -895,7 +895,7 @@ TEST_P(CoverageMappingTest, decision_before_expansion) { addCMR(Counter::getCounter(0), "foo", 3, 23, 5, 2); // This(4:11) was put after Expansion(4:11) before the fix - addMCDCDecisionCMR(0, 2, "foo", 4, 11, 4, 20); + addMCDCDecisionCMR(3, 2, "foo", 4, 11, 4, 20); addExpansionCMR("foo", "A", 4, 11, 4, 12); addExpansionCMR("foo", "B", 4, 19, 4, 20);