Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
GHC
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Gesh
GHC
Commits
adf74bb1
Commit
adf74bb1
authored
27 years ago
by
sof
Browse files
Options
Downloads
Patches
Plain Diff
[project @ 1997-10-19 21:51:43 by sof]
Bargain multiplier opt_UnfoldingKeenessFactor added to discount computation
parent
d6de1c95
Loading
Loading
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
ghc/compiler/coreSyn/CoreUnfold.lhs
+12
-3
12 additions, 3 deletions
ghc/compiler/coreSyn/CoreUnfold.lhs
with
12 additions
and
3 deletions
ghc/compiler/coreSyn/CoreUnfold.lhs
+
12
−
3
View file @
adf74bb1
...
...
@@ -45,7 +45,8 @@ import Bag ( emptyBag, unitBag, unionBags, Bag )
import CmdLineOpts ( opt_UnfoldingCreationThreshold,
opt_UnfoldingUseThreshold,
opt_UnfoldingConDiscount
opt_UnfoldingConDiscount,
opt_UnfoldingKeenessFactor
)
import Constants ( uNFOLDING_CHEAP_OP_COST,
uNFOLDING_DEAR_OP_COST,
...
...
@@ -482,13 +483,21 @@ smallEnoughToInline _ _ UnfoldNever = False
smallEnoughToInline arg_is_evald_s result_is_scruted
(UnfoldIfGoodArgs m_tys_wanted n_vals_wanted discount_vec size scrut_discount)
= enough_args n_vals_wanted arg_is_evald_s &&
discount
ed_size
<= opt_UnfoldingUseThreshold
size -
discount <= opt_UnfoldingUseThreshold
where
enough_args n [] | n > 0 = False -- A function with no value args => don't unfold
enough_args _ _ = True -- Otherwise it's ok to try
discounted_size = (size - args_discount) - result_discount
-- We multiple the raw discounts (args_discount and result_discount)
-- ty opt_UnfoldingKeenessFactor because the former have to do with
-- *size* whereas the discounts imply that there's some extra *efficiency*
-- to be gained (e.g. beta reductions, case reductions) by inlining.
discount :: Int
discount = round (
opt_UnfoldingKeenessFactor *
fromInt (args_discount + result_discount)
)
args_discount = sum (zipWith arg_discount discount_vec arg_is_evald_s)
result_discount | result_is_scruted = scrut_discount
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment