[clang] [clang][LifetimeSafety] Fix unnamed TimeTraceScope in computePersistentOrigins (PR #213521)

Gábor Horváth via cfe-commits cfe-commits at lists.llvm.org
Sun Aug 2 02:59:43 PDT 2026


https://github.com/Xazax-hun created https://github.com/llvm/llvm-project/pull/213521

The TimeTraceScope was constructed as a temporary and destroyed immediately, so the prepass was reported as taking ~0. It actually accounts for ~14% of LoanPropagation in some cases. 

>From d5bbe657fdb477d6c982144b1e8f7463770bdfd5 Mon Sep 17 00:00:00 2001
From: Gabor Horvath <gaborh at apple.com>
Date: Sun, 2 Aug 2026 10:57:01 +0100
Subject: [PATCH] [clang][LifetimeSafety] Fix unnamed TimeTraceScope in
 computePersistentOrigins

The TimeTraceScope was constructed as a temporary and destroyed
immediately, so the prepass was reported as taking ~0. It actually
accounts for ~14% of LoanPropagation.
---
 clang/lib/Analysis/LifetimeSafety/LoanPropagation.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/clang/lib/Analysis/LifetimeSafety/LoanPropagation.cpp b/clang/lib/Analysis/LifetimeSafety/LoanPropagation.cpp
index 078892bd48c10..12b88c18b90b4 100644
--- a/clang/lib/Analysis/LifetimeSafety/LoanPropagation.cpp
+++ b/clang/lib/Analysis/LifetimeSafety/LoanPropagation.cpp
@@ -29,7 +29,7 @@ namespace clang::lifetimes::internal {
 // referenced in more than one basic block.
 static llvm::BitVector computePersistentOrigins(const FactManager &FactMgr,
                                                 const CFG &C) {
-  llvm::TimeTraceScope("ComputePersistentOrigins");
+  llvm::TimeTraceScope TimeProfile("ComputePersistentOrigins");
   unsigned NumOrigins = FactMgr.getOriginMgr().getNumOrigins();
   llvm::BitVector PersistentOrigins(NumOrigins);
 



More information about the cfe-commits mailing list