From aa4b744d51aa6bdb46064f981ea8e001627921d6 Mon Sep 17 00:00:00 2001 From: Ben Gamari Date: Mon, 10 Aug 2020 15:53:51 -0400 Subject: testsuite: Only run llvm ways if llc is available As noted in #18560, we previously would always run the LLVM ways since `configure` would set `SettingsLlcCommand` to something non-null when it otherwise couldn't find the `llc` executable. Now we rather probe for the existence of the `llc` executable in the testsuite driver. Fixes #18560. --- testsuite/config/ghc | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'testsuite/config') diff --git a/testsuite/config/ghc b/testsuite/config/ghc index 4f053eb50f..c54ac6b385 100644 --- a/testsuite/config/ghc +++ b/testsuite/config/ghc @@ -64,10 +64,6 @@ else: if (config.have_profiling and ghc_with_threaded_rts): config.run_ways.append('profthreaded') -if (ghc_with_llvm and not config.unregisterised): - config.compile_ways.append('optllvm') - config.run_ways.append('optllvm') - # WinIO I/O manager for Windows if windows: winio_ways = ['winio', 'winio_threaded'] @@ -195,6 +191,17 @@ def get_compiler_info(): config.have_ncg = compilerInfoDict.get("Have native code generator", "NO") == "YES" + # Detect whether an LLVM toolhain is available + llc_path = compilerInfoDict.get("LLVM llc command") + config.have_llvm = shutil.which(llc_path) is not None + if config.unregisterised: + print("Unregisterised build; skipping LLVM ways...") + elif config.have_llvm: + config.compile_ways.append('optllvm') + config.run_ways.append('optllvm') + else: + print("Failed to find `llc` command; skipping LLVM ways...") + # Whether GHC itself was built using the LLVM backend. We need to know this # since some tests in ext-interp fail when stage2 ghc is built using # LLVM. See #16087. -- cgit v1.2.1