[llvm] [opt-viewer] Account for optimization records YAML files generated by LTO (PR #135059)

Min-Yih Hsu via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 9 10:47:52 PDT 2025


https://github.com/mshockwave created https://github.com/llvm/llvm-project/pull/135059

The optimization records YAML files generated by Clang's LTO pipeline are named "\*.opt.ld.yaml" rather than "\*.opt.yaml". This patch adds that pattern into the search list of `find_opt_files` as well.

>From 758d4bfcf488302baad10a0f4f87abdf2a1d0894 Mon Sep 17 00:00:00 2001
From: Min Hsu <min.hsu at sifive.com>
Date: Wed, 9 Apr 2025 10:35:26 -0700
Subject: [PATCH] [opt-viewer] Account for optimization records YAML generated
 by LTO

---
 llvm/tools/opt-viewer/optrecord.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/llvm/tools/opt-viewer/optrecord.py b/llvm/tools/opt-viewer/optrecord.py
index 8014204a64f45..4ff092dfc4869 100644
--- a/llvm/tools/opt-viewer/optrecord.py
+++ b/llvm/tools/opt-viewer/optrecord.py
@@ -361,6 +361,6 @@ def find_opt_files(*dirs_or_files):
                     d for d in subdirs if not os.path.ismount(os.path.join(dir, d))
                 ]
                 for file in files:
-                    if fnmatch.fnmatch(file, "*.opt.yaml*"):
+                    if fnmatch.fnmatch(file, "*.opt.yaml*") or fnmatch.fnmatch(file, "*.opt.ld.yaml*"):
                         all.append(os.path.join(dir, file))
     return all



More information about the llvm-commits mailing list