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
1cf0c8ad
Commit
1cf0c8ad
authored
Oct 17, 2013
by
Jan Stolarek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Optimise stack checks that are always false
Fix a bug introduced in
94125c97
. See Note [Always false stack check]
parent
7a58033f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
12 deletions
+12
-12
compiler/cmm/CmmLayoutStack.hs
compiler/cmm/CmmLayoutStack.hs
+12
-12
No files found.
compiler/cmm/CmmLayoutStack.hs
View file @
1cf0c8ad
...
...
@@ -773,24 +773,24 @@ areaToSp :: DynFlags -> ByteOff -> ByteOff -> (Area -> StackLoc) -> CmmExpr -> C
areaToSp
dflags
sp_old
_sp_hwm
area_off
(
CmmStackSlot
area
n
)
=
cmmOffset
dflags
(
CmmReg
spReg
)
(
sp_old
-
area_off
area
-
n
)
areaToSp
dflags
_
sp_hwm
_
(
CmmLit
CmmHighStackMark
)
=
mkIntExpr
dflags
sp_hwm
areaToSp
dflags
_
_
_
(
CmmMachOp
(
MO_U_Lt
_
)
-- Note [
null
stack check]
areaToSp
dflags
_
_
_
(
CmmMachOp
(
MO_U_Lt
_
)
-- Note [
Always false
stack check]
[
CmmMachOp
(
MO_Sub
_
)
[
CmmReg
(
CmmGlobal
Sp
)
,
CmmLit
(
CmmInt
0
_
)],
CmmReg
(
CmmGlobal
SpLim
)])
=
zeroExpr
dflags
[
CmmRegOff
(
CmmGlobal
Sp
)
off
,
CmmLit
(
CmmInt
lit
_
)],
CmmReg
(
CmmGlobal
SpLim
)])
|
fromIntegral
off
==
lit
=
zeroExpr
dflags
areaToSp
_
_
_
_
other
=
other
--
-----------------------------------------------------------------------------
--
Note [null stack check]
--
Note [Always false stack check]
--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
--
--
If the high-water Sp is zero, then we end up with
--
We can optimise stack checks of the form
--
-- if (
Sp - 0
< SpLim) then .. else ..
-- if (
(Sp + x) - x
< SpLim) then .. else ..
--
-- and possibly some dead code for the failure case. Optimising this
-- away depends on knowing that SpLim <= Sp, so it is really the job
-- where x is an integer offset. Optimising this away depends on knowing that
-- SpLim <= Sp, so it is really the job of the stack layout algorithm, hence we
-- do it now. This is also convenient because sinking pass will later drop the
-- dead code.
optStackCheck
::
CmmNode
O
C
->
CmmNode
O
C
...
...
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