[llvm] 88383f1 - [llvm-exegesis] if lit can't find llvm-exegesis, fail gracefully

Ties Stuij via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 27 08:35:25 PDT 2023


Author: Ties Stuij
Date: 2023-03-27T16:33:18+01:00
New Revision: 88383f18f3a693f9ea02733c680a32961e038b1e

URL: https://github.com/llvm/llvm-project/commit/88383f18f3a693f9ea02733c680a32961e038b1e
DIFF: https://github.com/llvm/llvm-project/commit/88383f18f3a693f9ea02733c680a32961e038b1e.diff

LOG: [llvm-exegesis] if lit can't find llvm-exegesis, fail gracefully

currently in can_use_perfcounters() in
llvm/test/tools/llvm-exegesis/lit.local.cfg, we check if we can execute
llvm-exegesis. But we don't check if we did actually find llvm-exegesis. If we
didn't, lit.util.which() will return None, and we try to execute that.

Reviewed By: courbet

Differential Revision: https://reviews.llvm.org/D146964

Added: 
    

Modified: 
    llvm/test/tools/llvm-exegesis/lit.local.cfg

Removed: 
    


################################################################################
diff  --git a/llvm/test/tools/llvm-exegesis/lit.local.cfg b/llvm/test/tools/llvm-exegesis/lit.local.cfg
index a932f3270ca8d..22b01609cf2a0 100644
--- a/llvm/test/tools/llvm-exegesis/lit.local.cfg
+++ b/llvm/test/tools/llvm-exegesis/lit.local.cfg
@@ -14,6 +14,9 @@ def can_use_perf_counters(mode, extra_options=[]):
     # only know that at runtime, so we try to measure an empty code snippet
     # and bail out on error.
     llvm_exegesis_exe = lit.util.which('llvm-exegesis', config.llvm_tools_dir)
+    if llvm_exegesis_exe is None:
+       print('could not find llvm-exegesis')
+       return False
     try:
         return_code = subprocess.call(
             [llvm_exegesis_exe, '-mode', mode, '-snippets-file', '/dev/null'] + extra_options,


        


More information about the llvm-commits mailing list