From 7c886d5d9265177e5dadb7ac5704cccffc3b95e0 Mon Sep 17 00:00:00 2001 From: Fangrui Song Date: Fri, 10 Jan 2025 22:12:46 -0800 Subject: [PATCH] PassTimingInfo: test TheTimeInfo first. NFC TheTimeInfo is a member variable and is often non-null, allowing the caller `getPassTimer` to skip one check. --- llvm/lib/IR/PassTimingInfo.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/llvm/lib/IR/PassTimingInfo.cpp b/llvm/lib/IR/PassTimingInfo.cpp index 3816eff5c0f2..46db2c74a5c7 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.