[llvm] 7c886d5 - PassTimingInfo: test TheTimeInfo first. NFC

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 10 22:12:58 PST 2025


Author: Fangrui Song
Date: 2025-01-10T22:12:47-08:00
New Revision: 7c886d5d9265177e5dadb7ac5704cccffc3b95e0

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

LOG: PassTimingInfo: test TheTimeInfo first. NFC

TheTimeInfo is a member variable and is often non-null, allowing the
caller `getPassTimer` to skip one check.

Added: 
    

Modified: 
    llvm/lib/IR/PassTimingInfo.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/IR/PassTimingInfo.cpp b/llvm/lib/IR/PassTimingInfo.cpp
index 3816eff5c0f22d..46db2c74a5c765 100644
--- a/llvm/lib/IR/PassTimingInfo.cpp
+++ b/llvm/lib/IR/PassTimingInfo.cpp
@@ -103,7 +103,7 @@ PassTimingInfo::~PassTimingInfo() {
 }
 
 void PassTimingInfo::init() {
-  if (!TimePassesIsEnabled || TheTimeInfo)
+  if (TheTimeInfo || !TimePassesIsEnabled)
     return;
 
   // Constructed the first time this is called, iff -time-passes is enabled.


        


More information about the llvm-commits mailing list