Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Glasgow Haskell Compiler
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Iterations
Merge Requests
0
Merge Requests
0
Requirements
Requirements
List
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Package Registry
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issue
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Shayne Fletcher
Glasgow Haskell Compiler
Commits
24b4bfbc
Commit
24b4bfbc
authored
Oct 25, 2012
by
Simon Marlow
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix bug in
88a6f863
(#7366)
parent
afbceef0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
20 deletions
+20
-20
compiler/cmm/CmmSink.hs
compiler/cmm/CmmSink.hs
+20
-20
No files found.
compiler/cmm/CmmSink.hs
View file @
24b4bfbc
...
...
@@ -365,23 +365,31 @@ tryToInline dflags live node assigs = go usages node [] assigs
go
_usages
node
_skipped
[]
=
(
node
,
[]
)
go
usages
node
skipped
(
a
@
(
l
,
rhs
,
_
)
:
rest
)
|
can_inline
=
inline_and_discard
|
isTrivial
rhs
=
inline_and_keep
|
cannot_inline
=
dont_inline
|
occurs_once
=
inline_and_discard
|
isTrivial
rhs
=
inline_and_keep
|
otherwise
=
dont_inline
where
inline_and_discard
=
go
usages'
node'
skipped
rest
inline_and_discard
=
go
usages'
inl_node
skipped
rest
where
usages'
=
foldRegsUsed
addUsage
usages
rhs
inline_and_keep
=
(
node''
,
a
:
rest'
)
where
(
node''
,
rest'
)
=
go
usages'
node'
(
l
:
skipped
)
res
t
dont_inline
=
keep
node
-- don't inline the assignment, keep it
inline_and_keep
=
keep
inl_node
-- inline the assignment, keep i
t
can_inline
=
not
(
l
`
elemRegSet
`
live
)
&&
not
(
skipped
`
regsUsedIn
`
rhs
)
-- Note [dependent assignments]
&&
okToInline
dflags
rhs
node
&&
lookupUFM
usages
l
==
Just
1
keep
node'
=
(
final_node
,
a
:
rest'
)
where
(
final_node
,
rest'
)
=
go
usages'
node'
(
l
:
skipped
)
rest
usages'
=
foldRegsUsed
(
\
m
r
->
addToUFM
m
r
2
)
usages
rhs
-- we must not inline anything that is mentioned in the RHS
-- of a binding that we have already skipped, so we set the
-- usages of the regs on the RHS to 2.
usages'
=
foldRegsUsed
addUsage
usages
rhs
cannot_inline
=
skipped
`
regsUsedIn
`
rhs
-- Note [dependent assignments]
||
not
(
okToInline
dflags
rhs
node
)
node'
=
mapExpDeep
inline
node
occurs_once
=
not
(
l
`
elemRegSet
`
live
)
&&
lookupUFM
usages
l
==
Just
1
inl_node
=
mapExpDeep
inline
node
where
inline
(
CmmReg
(
CmmLocal
l'
))
|
l
==
l'
=
rhs
inline
(
CmmRegOff
(
CmmLocal
l'
)
off
)
|
l
==
l'
=
cmmOffset
dflags
rhs
off
...
...
@@ -389,14 +397,6 @@ tryToInline dflags live node assigs = go usages node [] assigs
inline
(
CmmMachOp
op
args
)
=
cmmMachOpFold
dflags
op
args
inline
other
=
other
go
usages
node
skipped
(
assig
@
(
l
,
rhs
,
_
)
:
rest
)
=
(
node'
,
assig
:
rest'
)
where
(
node'
,
rest'
)
=
go
usages'
node
(
l
:
skipped
)
rest
usages'
=
foldRegsUsed
(
\
m
r
->
addToUFM
m
r
2
)
usages
rhs
-- we must not inline anything that is mentioned in the RHS
-- of a binding that we have already skipped, so we set the
-- usages of the regs on the RHS to 2.
-- Note [dependent assignments]
--
-- If our assignment list looks like
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment