summaryrefslogtreecommitdiff
path: root/compiler/nativeGen
diff options
context:
space:
mode:
authorAndreas Klebinger <klebinger.andreas@gmx.at>2018-04-13 13:23:13 -0400
committerBen Gamari <ben@smart-cactus.org>2018-04-13 14:17:14 -0400
commit3c7f9e74ca858de17bc63b862c77cbb3f8b0ee51 (patch)
treeaf721ec9e3cca9630d331be2843606aa51963529 /compiler/nativeGen
parent00b8ecb78624511a045120673b01fafe5794ecdc (diff)
downloadhaskell-3c7f9e74ca858de17bc63b862c77cbb3f8b0ee51.tar.gz
Make shortcutting at the asm stage toggleable and default for O2.
Shortcutting during the asm stage of codegen is often redundant as most cases get caught during the Cmm passes. For example during compilation of all of nofib only 508 jumps are eleminated. For this reason I moved the pass from -O1 to -O2. I also made it toggleable with -fasm-shortcutting. Test Plan: ci Reviewers: bgamari Reviewed By: bgamari Subscribers: thomie, carter Differential Revision: https://phabricator.haskell.org/D4555
Diffstat (limited to 'compiler/nativeGen')
-rw-r--r--compiler/nativeGen/AsmCodeGen.hs6
1 files changed, 4 insertions, 2 deletions
diff --git a/compiler/nativeGen/AsmCodeGen.hs b/compiler/nativeGen/AsmCodeGen.hs
index 6b20a12016..5d290858b8 100644
--- a/compiler/nativeGen/AsmCodeGen.hs
+++ b/compiler/nativeGen/AsmCodeGen.hs
@@ -934,8 +934,10 @@ shortcutBranches
-> [NatCmmDecl statics instr]
shortcutBranches dflags ncgImpl tops
- | optLevel dflags < 1 = tops -- only with -O or higher
- | otherwise = map (apply_mapping ncgImpl mapping) tops'
+ | gopt Opt_AsmShortcutting dflags
+ = map (apply_mapping ncgImpl mapping) tops'
+ | otherwise
+ = tops
where
(tops', mappings) = mapAndUnzip (build_mapping ncgImpl) tops
mapping = plusUFMList mappings