[PATCH] D141342: [perf-training] Check extension in findFilesWithExtension

Amir Ayupov via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jan 9 18:14:05 PST 2023


Amir created this revision.
Amir added reviewers: phosek, beanz.
Herald added a subscriber: pengfei.
Herald added a project: All.
Amir requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

`findFilesWithExtension` helper checks for `endswith(extension)` instead of
exactly matching the file extension. This causes it to match unrelated files,
for example, `.profdata` files while matching `.fdata` files:

http://157.230.108.44:8011/#/builders/56/builds/247

  Merging data from /worker/worker/bolt-x86_64-ubuntu-clang-bolt-gcc/build/tools/clang/prof.fdata.1124569.fdata...
  Merging data from /worker/worker/bolt-x86_64-ubuntu-clang-bolt-gcc/build/tools/clang/test/Frontend/Output/optimization-remark-with-hotness-new-pm.c.tmp.profdata...


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D141342

Files:
  clang/utils/perf-training/perf-helper.py


Index: clang/utils/perf-training/perf-helper.py
===================================================================
--- clang/utils/perf-training/perf-helper.py
+++ clang/utils/perf-training/perf-helper.py
@@ -23,7 +23,7 @@
   filenames = []
   for root, dirs, files in os.walk(path): 
     for filename in files:
-      if filename.endswith(extension):
+      if os.path.splitext(filename)[1] == extension:
         filenames.append(os.path.join(root, filename))
   return filenames
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D141342.487631.patch
Type: text/x-patch
Size: 486 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230110/d2787e80/attachment.bin>


More information about the cfe-commits mailing list