[Git][ghc/ghc][master] testsuite: Only run llvm ways if llc is available

Marge Bot gitlab at gitlab.haskell.org
Wed Aug 19 02:11:39 UTC 2020



 Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC


Commits:
aa4b744d by Ben Gamari at 2020-08-18T22:11:36-04:00
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.

- - - - -


4 changed files:

- hadrian/src/Settings/Builders/RunTest.hs
- testsuite/config/ghc
- testsuite/driver/testglobals.py
- testsuite/mk/test.mk


Changes:

=====================================
hadrian/src/Settings/Builders/RunTest.hs
=====================================
@@ -70,7 +70,6 @@ runTestBuilderArgs = builder RunTest ? do
     withSMP             <- getBooleanSetting TestGhcWithSMP
     debugged            <- getBooleanSetting TestGhcDebugged
     keepFiles           <- expr (testKeepFiles <$> userSetting defaultTestArgs)
-    withLlvm            <- expr (not . null <$> settingsFileSetting SettingsFileSetting_LlcCommand)
 
     accept <- expr (testAccept <$> userSetting defaultTestArgs)
     (acceptPlatform, acceptOS) <- expr . liftIO $
@@ -126,8 +125,6 @@ runTestBuilderArgs = builder RunTest ? do
             , arg "-e", arg $ asBool "config.have_profiling=" (hasLibWay profiling)
             , arg "-e", arg $ asBool "config.have_fast_bignum=" (bignumBackend /= "native" && not bignumCheck)
             , arg "-e", arg $ asBool "ghc_with_smp=" withSMP
-            , arg "-e", arg $ asBool "ghc_with_llvm=" withLlvm
-
 
             , arg "-e", arg $ "config.ghc_dynamic_by_default=" ++ show hasDynamicByDefault
             , arg "-e", arg $ "config.ghc_dynamic=" ++ show hasDynamic


=====================================
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.


=====================================
testsuite/driver/testglobals.py
=====================================
@@ -115,6 +115,9 @@ class TestConfig:
         self.way_flags = {}  # type: Dict[WayName, List[str]]
         self.way_rts_flags = {}  # type: Dict[WayName, List[str]]
 
+        # Do we have a functional LLVM toolchain?
+        self.have_llvm = False
+
         # Do we have vanilla libraries?
         self.have_vanilla = False
 


=====================================
testsuite/mk/test.mk
=====================================
@@ -194,18 +194,6 @@ else
 RUNTEST_OPTS += -e ghc_with_smp=False
 endif
 
-# Does the LLVM backend work?
-ifeq "$(LLC)" ""
-RUNTEST_OPTS += -e ghc_with_llvm=False
-else ifeq "$(TargetARCH_CPP)" "powerpc"
-RUNTEST_OPTS += -e ghc_with_llvm=False
-else ifneq "$(LLC)" "llc"
-# If we have a real detected value for LLVM, then it really ought to work
-RUNTEST_OPTS += -e ghc_with_llvm=True
-else
-RUNTEST_OPTS += -e ghc_with_llvm=False
-endif
-
 ifeq "$(WINDOWS)" "YES"
 RUNTEST_OPTS += -e windows=True
 else



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/aa4b744d51aa6bdb46064f981ea8e001627921d6

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/aa4b744d51aa6bdb46064f981ea8e001627921d6
You're receiving this email because of your account on gitlab.haskell.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20200818/06e1f01c/attachment-0001.html>


More information about the ghc-commits mailing list