From 6815603f271484766425ff2e37043b78da2d073c Mon Sep 17 00:00:00 2001
From: Ben Gamari <ben@smart-cactus.org>
Date: Wed, 11 Nov 2020 17:00:57 -0500
Subject: [PATCH] hadrian: Drop redundant flavour definitions

Drop the profiled, LLVM, and ThreadSanitizer flavour definitions as
these can now be realized with flavour transformers.
---
 hadrian/doc/flavours.md                       | 29 ++-----------------
 hadrian/hadrian.cabal                         |  3 --
 hadrian/src/Settings.hs                       | 11 ++-----
 hadrian/src/Settings/Flavours/Llvm.hs         | 25 ----------------
 hadrian/src/Settings/Flavours/Profiled.hs     | 22 --------------
 .../src/Settings/Flavours/ThreadSanitizer.hs  |  9 ------
 6 files changed, 5 insertions(+), 94 deletions(-)
 delete mode 100644 hadrian/src/Settings/Flavours/Llvm.hs
 delete mode 100644 hadrian/src/Settings/Flavours/Profiled.hs
 delete mode 100644 hadrian/src/Settings/Flavours/ThreadSanitizer.hs

diff --git a/hadrian/doc/flavours.md b/hadrian/doc/flavours.md
index f10b698b580a..4dac301dadb4 100644
--- a/hadrian/doc/flavours.md
+++ b/hadrian/doc/flavours.md
@@ -99,16 +99,6 @@ when compiling the `compiler` library, and `hsGhc` when compiling/linking the GH
     <td>-O</td>
     <td>-O2</td>
   </tr>
-  <tr>
-    <th>prof</td>
-    <td>-O0<br>-H64m</td>
-    <td>-O0<br>-H64m</td>
-    <td></td>
-    <td>-O</td>
-    <td>-O2</td>
-    <td>-O</td>
-    <td>-O</td>
-  </tr>
   <tr>
     <th>bench</td>
     <td>-O<br>-H64m</td>
@@ -166,14 +156,6 @@ when compiling the `compiler` library, and `hsGhc` when compiling/linking the GH
   </tr>
 </table>
 
-### LLVM variants
-
-In addition to the above, there are LLVM variants for the flavours `quick`,
-`prof`, `perf` and `bench`, available by appending a `-llvm` suffix (i.e.,
-`quick-llvm` for the LLVM variant of `quick`). These differ only in that there
-is an additional `-fllvm` flag in `hsDefault` when the stage0 compiler is GHC.
-See `src/Settings/Flavours/Llvm.hs` for details.
-
 ## Flavour transformers
 
 Each of the flavours described above is intended as a starting-point for
@@ -245,7 +227,6 @@ information. The following table lists ways that are built in different flavours
         <th rowspan="2">Flavour</th>
         <th colspan="2">Library ways</th>
         <th colspan="2">RTS ways</th>
-        <th colspan="2">Profiled GHC</th>
     </tr>
     <tr>
         <th>stage0</th>
@@ -256,7 +237,7 @@ information. The following table lists ways that are built in different flavours
         <th>stage1+</th>
     </tr>
     <tr>
-    <th>default<br>perf<br>prof<br>devel1<br>devel2<br>perf-llvm<br>prof-llvm</td>
+    <th>default<br>perf<br>prof<br>devel1<br>devel2</td>
     <td>vanilla</td>
     <td>vanilla<br>profiling<br>dynamic</td>
     <td>logging<br>debug<br>threaded<br>threadedDebug<br>threadedLogging
@@ -269,11 +250,9 @@ information. The following table lists ways that are built in different flavours
         <br>debugDynamic<br>threadedDynamic<br>threadedDebugDynamic
         <br>loggingDynamic<br>threadedLoggingDynamic
     </td>
-    <td>Only in<br>prof<br>flavour</td>
-    <td>Only in<br>prof<br>flavour</td>
 </tr>
 <tr>
-    <th>quick<br>quick-llvm<br>quick-validate<br>quick-debug</th>
+    <th>quick<br>quick-validate<br>quick-debug</th>
     <td>vanilla</td>
     <td>vanilla<br>dynamic</td>
     <td>logging<br>debug<br>threaded<br>threadedDebug<br>threadedLogging
@@ -284,8 +263,6 @@ information. The following table lists ways that are built in different flavours
         <br>debugDynamic<br>threadedDynamic<br>threadedDebugDynamic
         <br>loggingDynamic<br>threadedLoggingDynamic
     </td>
-    <td>No</td>
-    <td>No</td>
 </tr>
 <tr>
     <th>quickest<br>bench</th>
@@ -293,7 +270,5 @@ information. The following table lists ways that are built in different flavours
     <td>vanilla</td>
     <td>vanilla<br>threaded</td>
     <td>vanilla<br>threaded</td>
-    <td>No</td>
-    <td>No</td>
 </tr>
 </table>
diff --git a/hadrian/hadrian.cabal b/hadrian/hadrian.cabal
index 4184aadd5ffc..be2385262b12 100644
--- a/hadrian/hadrian.cabal
+++ b/hadrian/hadrian.cabal
@@ -106,13 +106,10 @@ executable hadrian
                        , Settings.Flavours.Benchmark
                        , Settings.Flavours.Development
                        , Settings.Flavours.GhcInGhci
-                       , Settings.Flavours.Llvm
                        , Settings.Flavours.Performance
-                       , Settings.Flavours.Profiled
                        , Settings.Flavours.Quick
                        , Settings.Flavours.QuickCross
                        , Settings.Flavours.Quickest
-                       , Settings.Flavours.ThreadSanitizer
                        , Settings.Flavours.Validate
                        , Settings.Packages
                        , Settings.Parser
diff --git a/hadrian/src/Settings.hs b/hadrian/src/Settings.hs
index 43af1330ca7a..23f2708b9fac 100755
--- a/hadrian/src/Settings.hs
+++ b/hadrian/src/Settings.hs
@@ -15,13 +15,10 @@ import {-# SOURCE #-} Settings.Default
 import Settings.Flavours.Benchmark
 import Settings.Flavours.Development
 import Settings.Flavours.GhcInGhci
-import Settings.Flavours.Llvm
 import Settings.Flavours.Performance
-import Settings.Flavours.Profiled
 import Settings.Flavours.Quick
 import Settings.Flavours.Quickest
 import Settings.Flavours.QuickCross
-import Settings.Flavours.ThreadSanitizer
 import Settings.Flavours.Validate
 
 import Control.Monad.Except
@@ -54,13 +51,11 @@ stagePackages stage = do
 hadrianFlavours :: [Flavour]
 hadrianFlavours =
     [ benchmarkFlavour, defaultFlavour, developmentFlavour Stage1
-    , developmentFlavour Stage2, performanceFlavour, profiledFlavour
+    , developmentFlavour Stage2, performanceFlavour
     , quickFlavour, quickValidateFlavour, quickDebugFlavour
     , quickestFlavour
-    , quickCrossFlavour, benchmarkLlvmFlavour
-    , performanceLlvmFlavour, profiledLlvmFlavour, quickLlvmFlavour
-    , ghcInGhciFlavour, validateFlavour, slowValidateFlavour
-    , threadSanitizerFlavour ]
+    , quickCrossFlavour
+    , ghcInGhciFlavour, validateFlavour, slowValidateFlavour ]
 
 -- | This action looks up a flavour with the name given on the
 --   command line with @--flavour@, defaulting to 'userDefaultFlavour'
diff --git a/hadrian/src/Settings/Flavours/Llvm.hs b/hadrian/src/Settings/Flavours/Llvm.hs
deleted file mode 100644
index 3882e73f4599..000000000000
--- a/hadrian/src/Settings/Flavours/Llvm.hs
+++ /dev/null
@@ -1,25 +0,0 @@
-module Settings.Flavours.Llvm (
-  benchmarkLlvmFlavour,
-  performanceLlvmFlavour,
-  profiledLlvmFlavour,
-  quickLlvmFlavour,
-) where
-
-import Flavour
-
-import Settings.Flavours.Benchmark
-import Settings.Flavours.Performance
-import Settings.Flavours.Profiled
-import Settings.Flavours.Quick
-
--- Please update doc/flavours.md when changing this file.
-benchmarkLlvmFlavour, performanceLlvmFlavour, profiledLlvmFlavour, quickLlvmFlavour :: Flavour
-benchmarkLlvmFlavour   = mkLlvmFlavour benchmarkFlavour
-performanceLlvmFlavour = mkLlvmFlavour performanceFlavour
-profiledLlvmFlavour    = mkLlvmFlavour profiledFlavour
-quickLlvmFlavour       = mkLlvmFlavour quickFlavour
-
--- | Turn a flavour into an LLVM flavour
-mkLlvmFlavour :: Flavour -> Flavour
-mkLlvmFlavour flav = viaLlvmBackend $ flav
-    { name = name flav ++ "-llvm" }
diff --git a/hadrian/src/Settings/Flavours/Profiled.hs b/hadrian/src/Settings/Flavours/Profiled.hs
deleted file mode 100644
index 49339f144699..000000000000
--- a/hadrian/src/Settings/Flavours/Profiled.hs
+++ /dev/null
@@ -1,22 +0,0 @@
-module Settings.Flavours.Profiled (profiledFlavour) where
-
-import Expression
-import Flavour
-import {-# SOURCE #-} Settings.Default
-
--- Please update doc/flavours.md when changing this file.
-profiledFlavour :: Flavour
-profiledFlavour = defaultFlavour
-    { name        = "prof"
-    , args        = defaultBuilderArgs <> profiledArgs <> defaultPackageArgs
-    , ghcProfiled = True
-    , dynamicGhcPrograms = pure False }
-
-profiledArgs :: Args
-profiledArgs = sourceArgs SourceArgs
-    { hsDefault  = mconcat
-        [ pure ["-O0", "-H64m"]
-        ]
-    , hsLibrary  = notStage0 ? arg "-O"
-    , hsCompiler = mconcat [stage0 ? arg "-O2", notStage0 ? arg "-O"]
-    , hsGhc      = arg "-O" }
diff --git a/hadrian/src/Settings/Flavours/ThreadSanitizer.hs b/hadrian/src/Settings/Flavours/ThreadSanitizer.hs
deleted file mode 100644
index 722370f5cd0d..000000000000
--- a/hadrian/src/Settings/Flavours/ThreadSanitizer.hs
+++ /dev/null
@@ -1,9 +0,0 @@
-module Settings.Flavours.ThreadSanitizer (threadSanitizerFlavour) where
-
-import Flavour
-import Settings.Flavours.Validate
-
-threadSanitizerFlavour :: Flavour
-threadSanitizerFlavour =
-  enableThreadSanitizer (validateFlavour
-    { name = "thread-sanitizer" })
-- 
GitLab