@@ -1627,20 +1627,31 @@ class CodeGenFunction : public CodeGenTypeCache {
16271627 }
16281628 void markStmtMaybeUsed (const Stmt *S) { PGO.markStmtMaybeUsed (S); }
16291629
1630+ enum CounterForIncrement {
1631+ UseExecPath = 0 ,
1632+ UseSkipPath,
1633+ };
1634+
16301635 // / Increment the profiler's counter for the given statement by \p StepV.
16311636 // / If \p StepV is null, the default increment is 1.
16321637 void incrementProfileCounter (const Stmt *S, llvm::Value *StepV = nullptr ) {
1633- incrementProfileCounter (false , S, false , StepV);
1638+ incrementProfileCounter (UseExecPath , S, false , StepV);
16341639 }
16351640
1636- void incrementProfileCounter (bool UseSkipPath, const Stmt *S,
1641+ // / Emit increment of Counter.
1642+ // / \param ExecSkip Use `Skipped` Counter if UseSkipPath is specified.
1643+ // / \param S The Stmt that Counter is associated.
1644+ // / \param UseBoth Mark both Exec/Skip as used. (for verification)
1645+ // / \param StepV The offset Value for adding to Counter.
1646+ void incrementProfileCounter (CounterForIncrement ExecSkip, const Stmt *S,
16371647 bool UseBoth = false ,
16381648 llvm::Value *StepV = nullptr ) {
16391649 if (CGM.getCodeGenOpts ().hasProfileClangInstr () &&
16401650 !CurFn->hasFnAttribute (llvm::Attribute::NoProfile) &&
16411651 !CurFn->hasFnAttribute (llvm::Attribute::SkipProfile)) {
16421652 auto AL = ApplyDebugLocation::CreateArtificial (*this );
1643- PGO.emitCounterSetOrIncrement (Builder, S, UseSkipPath, UseBoth, StepV);
1653+ PGO.emitCounterSetOrIncrement (Builder, S, (ExecSkip == UseSkipPath),
1654+ UseBoth, StepV);
16441655 }
16451656 PGO.setCurrentStmt (S);
16461657 }
0 commit comments