summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2020-04-20 11:05:06 -0400
committerBen Gamari <ben@smart-cactus.org>2020-04-20 13:27:37 -0400
commit0b57db5f9a6ff27bb4a29464c3bfdaf5f3e7857b (patch)
tree445fe5fdd2a10af68ba035c75a15eb02a0b6e7b8
parenteaed0a3289e4c24ff1a70c6fc4b7f8bae6cd2dd3 (diff)
downloadhaskell-wip/rip-out-fast-llvm.tar.gz
llvmGen: Remove -fast-llvm flagwip/rip-out-fast-llvm
Issue #18076 drew my attention to the undocumented `-fast-llvm` flag for the LLVM code generator introduced in 22733532171330136d87533d523f565f2a4f102f. Speaking to Moritz about this, the motivation for this flag was to avoid potential incompatibilities between LLVM and the assembler/linker toolchain by making LLVM responsible for machine-code generation. Unfortunately, this cannot possibly work: the LLVM backend's mangler performs a number of transforms on the assembler generated by LLVM that are necessary for correctness. These are currently: * mangling Haskell functions' symbol types to be `object` instead of `function` on ELF platforms (necessary for tables-next-to-code) * mangling AVX instructions to ensure that we don't assume alignment (which LLVM otherwise does) * mangling Darwin's subsections-via-symbols directives Given that these are all necessary I don't believe that we can support `-fast-llvm`. Let's rather remove it.
-rw-r--r--compiler/GHC/Driver/Pipeline.hs18
-rw-r--r--compiler/GHC/Driver/Session.hs2
-rw-r--r--docs/users_guide/expected-undocumented-flags.txt1
3 files changed, 1 insertions, 20 deletions
diff --git a/compiler/GHC/Driver/Pipeline.hs b/compiler/GHC/Driver/Pipeline.hs
index f61430b475..1fc37e0662 100644
--- a/compiler/GHC/Driver/Pipeline.hs
+++ b/compiler/GHC/Driver/Pipeline.hs
@@ -866,20 +866,6 @@ getOutputFilename stop_phase output basename dflags next_phase maybe_location
| otherwise = persistent
--- | The fast LLVM Pipeline skips the mangler and assembler,
--- emitting object code directly from llc.
---
--- slow: opt -> llc -> .s -> mangler -> as -> .o
--- fast: opt -> llc -> .o
---
--- hidden flag: -ffast-llvm
---
--- if keep-s-files is specified, we need to go through
--- the slow pipeline (Kavon Farvardin requested this).
-fastLlvmPipeline :: DynFlags -> Bool
-fastLlvmPipeline dflags
- = not (gopt Opt_KeepSFiles dflags) && gopt Opt_FastLlvm dflags
-
-- | LLVM Options. These are flags to be passed to opt and llc, to ensure
-- consistency we list them in pairs, so that they form groups.
llvmOptions :: DynFlags
@@ -890,7 +876,6 @@ llvmOptions dflags =
,"-relocation-model=" ++ rmodel) | not (null rmodel)]
++ [("-stack-alignment=" ++ (show align)
,"-stack-alignment=" ++ (show align)) | align > 0 ]
- ++ [("", "-filetype=obj") | fastLlvmPipeline dflags ]
-- Additional llc flags
++ [("", "-mcpu=" ++ mcpu) | not (null mcpu)
@@ -1472,8 +1457,7 @@ runPhase (RealPhase LlvmOpt) input_fn dflags
runPhase (RealPhase LlvmLlc) input_fn dflags
= do
- next_phase <- if | fastLlvmPipeline dflags -> maybeMergeForeign
- -- hidden debugging flag '-dno-llvm-mangler' to skip mangling
+ next_phase <- if -- hidden debugging flag '-dno-llvm-mangler' to skip mangling
| gopt Opt_NoLlvmMangler dflags -> return (As False)
| otherwise -> return LlvmMangle
diff --git a/compiler/GHC/Driver/Session.hs b/compiler/GHC/Driver/Session.hs
index 5ed6e093d7..c8ed59f97f 100644
--- a/compiler/GHC/Driver/Session.hs
+++ b/compiler/GHC/Driver/Session.hs
@@ -2815,8 +2815,6 @@ dynamic_flags_deps = [
(NoArg (setGeneralFlag Opt_D_faststring_stats))
, make_ord_flag defGhcFlag "dno-llvm-mangler"
(NoArg (setGeneralFlag Opt_NoLlvmMangler)) -- hidden flag
- , make_ord_flag defGhcFlag "fast-llvm"
- (NoArg (setGeneralFlag Opt_FastLlvm)) -- hidden flag
, make_ord_flag defGhcFlag "dno-typeable-binds"
(NoArg (setGeneralFlag Opt_NoTypeableBinds))
, make_ord_flag defGhcFlag "ddump-debug"
diff --git a/docs/users_guide/expected-undocumented-flags.txt b/docs/users_guide/expected-undocumented-flags.txt
index ea8543b58c..5e2101b03d 100644
--- a/docs/users_guide/expected-undocumented-flags.txt
+++ b/docs/users_guide/expected-undocumented-flags.txt
@@ -78,7 +78,6 @@
-fallow-overlapping-instances
-fallow-undecidable-instances
-farrows
--fast-llvm
-fbang-patterns
-fbuilding-cabal-package
-fconstraint-solver-iterations