[llvm] r297055 - [opt-diff] Fix the case when the script is invoked with directories

Adam Nemet via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 6 11:15:22 PST 2017


Author: anemet
Date: Mon Mar  6 13:15:22 2017
New Revision: 297055

URL: http://llvm.org/viewvc/llvm-project?rev=297055&view=rev
Log:
[opt-diff] Fix the case when the script is invoked with directories

Modified:
    llvm/trunk/utils/opt-viewer/opt-diff.py

Modified: llvm/trunk/utils/opt-viewer/opt-diff.py
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/opt-viewer/opt-diff.py?rev=297055&r1=297054&r2=297055&view=diff
==============================================================================
--- llvm/trunk/utils/opt-viewer/opt-diff.py (original)
+++ llvm/trunk/utils/opt-viewer/opt-diff.py Mon Mar  6 13:15:22 2017
@@ -21,6 +21,7 @@ import argparse
 from collections import defaultdict
 from multiprocessing import cpu_count, Pool
 import os, os.path
+import fnmatch
 
 def find_files(dir_or_file):
     if os.path.isfile(dir_or_file):
@@ -29,7 +30,8 @@ def find_files(dir_or_file):
     all = []
     for dir, subdirs, files in os.walk(dir_or_file):
         for file in files:
-            all.append( os.path.join(dir, file))
+            if fnmatch.fnmatch(file, "*.opt.yaml"):
+                all.append( os.path.join(dir, file))
     return all
 
 if __name__ == '__main__':




More information about the llvm-commits mailing list