summaryrefslogtreecommitdiff
path: root/compiler/main/DriverPipeline.hs
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2019-07-29 19:34:57 -0400
committerBen Gamari <ben@smart-cactus.org>2019-10-06 17:38:32 -0400
commit3da872c3d250b47dd4ce00f96bea5936601571fd (patch)
treef5df7cabd02fa688aad6e50bbf7763a151cf0ac9 /compiler/main/DriverPipeline.hs
parent8039b6257ce5288e9e38c2593ff2d5d6d316efd4 (diff)
downloadhaskell-wip/llvm-config.tar.gz
Refactor, document, and optimize LLVM configuration loadingwip/llvm-config
As described in the new Note [LLVM Configuration] in SysTools, we now load llvm-targets and llvm-passes lazily to avoid the overhead of doing so when -fllvm isn't used (also known as "the common case"). Noticed in #17003. Metric Decrease: T12234 T12150
Diffstat (limited to 'compiler/main/DriverPipeline.hs')
-rw-r--r--compiler/main/DriverPipeline.hs4
1 files changed, 2 insertions, 2 deletions
diff --git a/compiler/main/DriverPipeline.hs b/compiler/main/DriverPipeline.hs
index 38403940bd..f5a86a5550 100644
--- a/compiler/main/DriverPipeline.hs
+++ b/compiler/main/DriverPipeline.hs
@@ -900,7 +900,7 @@ llvmOptions dflags =
++ [("", "-mattr=" ++ attrs) | not (null attrs) ]
where target = platformMisc_llvmTarget $ platformMisc dflags
- Just (LlvmTarget _ mcpu mattr) = lookup target (llvmTargets dflags)
+ Just (LlvmTarget _ mcpu mattr) = lookup target (llvmTargets $ llvmConfig dflags)
-- Relocation models
rmodel | gopt Opt_PIC dflags = "pic"
@@ -1449,7 +1449,7 @@ runPhase (RealPhase LlvmOpt) input_fn dflags
-- we always (unless -optlo specified) run Opt since we rely on it to
-- fix up some pretty big deficiencies in the code we generate
optIdx = max 0 $ min 2 $ optLevel dflags -- ensure we're in [0,2]
- llvmOpts = case lookup optIdx $ llvmPasses dflags of
+ llvmOpts = case lookup optIdx $ llvmPasses $ llvmConfig dflags of
Just passes -> passes
Nothing -> panic ("runPhase LlvmOpt: llvm-passes file "
++ "is missing passes for level "