[clang] [llvm] [Coverage] Make additional counters available for BranchRegion. NFC. (PR #120930)

NAKAMURA Takumi via cfe-commits cfe-commits at lists.llvm.org
Mon Jan 5 18:06:29 PST 2026


================
@@ -1195,11 +1205,25 @@ std::pair<bool, bool> CodeGenPGO::getIsCounterPair(const Stmt *S) const {
 }
 
 void CodeGenPGO::emitCounterSetOrIncrement(CGBuilderTy &Builder, const Stmt *S,
+                                           bool UseSkipPath, bool UseBoth,
                                            llvm::Value *StepV) {
-  if (!RegionCounterMap || !Builder.GetInsertBlock())
+  if (!RegionCounterMap)
     return;
 
-  unsigned Counter = (*RegionCounterMap)[S].Executed;
+  unsigned Counter;
+  auto &TheMap = (*RegionCounterMap)[S];
+  if (!UseSkipPath) {
+    if (!TheMap.Executed.hasValue())
+      return;
+    Counter = TheMap.Executed;
+  } else {
+    if (!TheMap.Skipped.hasValue())
+      return;
+    Counter = TheMap.Skipped;
----------------
chapuni wrote:

Updated. (babbcf8)

https://github.com/llvm/llvm-project/pull/120930


More information about the cfe-commits mailing list