[llvm] [DTLTO] Added missing timetrace "Check cache for DTLTO" message. (PR #203215)

Konstantin Belochapka via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 11 03:27:19 PDT 2026


https://github.com/kbelochapka updated https://github.com/llvm/llvm-project/pull/203215

>From e7f28c373248a13e85c74c0ce8f06ed102001a4e Mon Sep 17 00:00:00 2001
From: Konstantin Belochapka <konstantin.belochapka at sony.com>
Date: Thu, 11 Jun 2026 02:29:11 -0700
Subject: [PATCH 1/2] [dtlto] Added missing timetrace <Check cache for DTLTO>
 message.

---
 llvm/lib/DTLTO/DTLTO.cpp                 | 2 ++
 llvm/test/ThinLTO/X86/dtlto/timetrace.ll | 9 +++++++++
 2 files changed, 11 insertions(+)

diff --git a/llvm/lib/DTLTO/DTLTO.cpp b/llvm/lib/DTLTO/DTLTO.cpp
index d1917eb8d954a..162f4a60ab9f9 100644
--- a/llvm/lib/DTLTO/DTLTO.cpp
+++ b/llvm/lib/DTLTO/DTLTO.cpp
@@ -104,6 +104,8 @@ Error lto::DTLTO::checkCacheHit(Job &J) {
   if (!Cache.isValid())
     return Error::success();
 
+  TimeTraceScope TimeScope("Check cache for DTLTO", J.SummaryIndexPath);
+
   auto CacheAddStreamExp = Cache(J.Task, J.CacheKey, J.ModuleID);
   if (Error Err = CacheAddStreamExp.takeError())
     return Err;
diff --git a/llvm/test/ThinLTO/X86/dtlto/timetrace.ll b/llvm/test/ThinLTO/X86/dtlto/timetrace.ll
index 73b70188221a1..4b79a590ca115 100644
--- a/llvm/test/ThinLTO/X86/dtlto/timetrace.ll
+++ b/llvm/test/ThinLTO/X86/dtlto/timetrace.ll
@@ -9,12 +9,15 @@ RUN: opt -thinlto-bc t2.ll -o t2.bc
 ; Generate fake object files for mock.py to return.
 RUN: touch t1.o t2.o
 
+RUN: rm -rf %t.cache && mkdir -p %t.cache
+
 ; Perform DTLTO and generate a time trace. mock.py does not do any compilation,
 ; instead it simply writes the contents of the object files supplied on the
 ; command line into the output object files in job order.
 RUN: llvm-lto2 run t1.bc t2.bc -o t.o \
 RUN:   -dtlto-distributor=%python \
 RUN:   -dtlto-distributor-arg=%llvm_src_root/utils/dtlto/mock.py,t1.o,t2.o \
+RUN:   --cache-dir=%t.cache \
 RUN:   --time-trace --time-trace-granularity=0 --time-trace-file=%t.json \
 RUN:   -r=t1.bc,t1,px \
 RUN:   -r=t2.bc,t2,px
@@ -28,6 +31,10 @@ CHECK-NEXT: "name": "Add input for DTLTO"
 CHECK-SAME:   "pid": [[#PID:]],
 CHECK-NEXT: "name": "Add input for DTLTO"
 CHECK-SAME:   "pid": [[#PID:]],
+CHECK-NEXT: "name": "Check cache for DTLTO"
+CHECK-SAME:   "pid": [[#PID:]],
+CHECK-NEXT: "name": "Check cache for DTLTO"
+CHECK-SAME:   "pid": [[#PID:]],
 CHECK-NEXT: "name": "Emit DTLTO JSON"
 CHECK-NEXT: "name": "Emit individual index for DTLTO"
 CHECK-SAME:   t1.1.[[#PID]].native.o.thinlto.bc"
@@ -39,6 +46,8 @@ CHECK-NEXT: "name": "Total Add DTLTO files to the link"
 CHECK-SAME:   "count": 1,
 CHECK-NEXT: "name": "Total Add input for DTLTO"
 CHECK-SAME:   "count": 2,
+CHECK-NEXT: "name": "Total Check cache for DTLTO"
+CHECK-SAME:   "count": 2,
 CHECK-NEXT: "name": "Total Emit DTLTO JSON"
 CHECK-SAME:   "count": 1,
 CHECK-NEXT: "name": "Total Emit individual index for DTLTO"

>From ee1512b073bba35bb40a288b65b250ffe121c2b4 Mon Sep 17 00:00:00 2001
From: Konstantin Belochapka <konstantin.belochapka at sony.com>
Date: Thu, 11 Jun 2026 03:05:08 -0700
Subject: [PATCH 2/2] [dtlto] Addressed review comments from Ben.

---
 llvm/test/ThinLTO/X86/dtlto/timetrace.ll | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/llvm/test/ThinLTO/X86/dtlto/timetrace.ll b/llvm/test/ThinLTO/X86/dtlto/timetrace.ll
index 4b79a590ca115..fee5ad037adc9 100644
--- a/llvm/test/ThinLTO/X86/dtlto/timetrace.ll
+++ b/llvm/test/ThinLTO/X86/dtlto/timetrace.ll
@@ -9,7 +9,7 @@ RUN: opt -thinlto-bc t2.ll -o t2.bc
 ; Generate fake object files for mock.py to return.
 RUN: touch t1.o t2.o
 
-RUN: rm -rf %t.cache && mkdir -p %t.cache
+RUN: mkdir cache
 
 ; Perform DTLTO and generate a time trace. mock.py does not do any compilation,
 ; instead it simply writes the contents of the object files supplied on the
@@ -17,7 +17,7 @@ RUN: rm -rf %t.cache && mkdir -p %t.cache
 RUN: llvm-lto2 run t1.bc t2.bc -o t.o \
 RUN:   -dtlto-distributor=%python \
 RUN:   -dtlto-distributor-arg=%llvm_src_root/utils/dtlto/mock.py,t1.o,t2.o \
-RUN:   --cache-dir=%t.cache \
+RUN:   --cache-dir=cache \
 RUN:   --time-trace --time-trace-granularity=0 --time-trace-file=%t.json \
 RUN:   -r=t1.bc,t1,px \
 RUN:   -r=t2.bc,t2,px



More information about the llvm-commits mailing list