Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
GHC
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
Tobias Decking
GHC
Commits
5b7c931a
Commit
5b7c931a
authored
Feb 20, 2003
by
simonpj
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[project @ 2003-02-20 13:00:24 by simonpj]
Eliminate bogus string-literal duplication
parent
d5aa9c5d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
5 deletions
+14
-5
ghc/compiler/basicTypes/Literal.lhs
ghc/compiler/basicTypes/Literal.lhs
+12
-3
ghc/compiler/coreSyn/CoreUtils.lhs
ghc/compiler/coreSyn/CoreUtils.lhs
+2
-2
No files found.
ghc/compiler/basicTypes/Literal.lhs
View file @
5b7c931a
...
...
@@ -8,7 +8,8 @@ module Literal
( Literal(..) -- Exported to ParseIface
, mkMachInt, mkMachWord
, mkMachInt64, mkMachWord64
, isLitLitLit, maybeLitLit, litSize, litIsDupable,
, isLitLitLit, maybeLitLit, litSize
, litIsDupable, litIsTrivial
, literalType, literalPrimRep
, hashLiteral
...
...
@@ -282,9 +283,17 @@ isLitLitLit _ = False
maybeLitLit (MachLitLit s t) = Just (s,t)
maybeLitLit _ = Nothing
litIsTrivial :: Literal -> Bool
-- True if there is absolutely no penalty to duplicating the literal
-- c.f. CoreUtils.exprIsTrivial
-- False principally of strings
litIsTrivial (MachStr _) = False
litIsTrivial other = True
litIsDupable :: Literal -> Bool
-- True if code space does not go bad if we duplicate this literal
-- False principally of strings
-- True if code space does not go bad if we duplicate this literal
-- c.f. CoreUtils.exprIsDupable
-- Currently we treat it just like litIsTrivial
litIsDupable (MachStr _) = False
litIsDupable other = True
...
...
ghc/compiler/coreSyn/CoreUtils.lhs
View file @
5b7c931a
...
...
@@ -45,7 +45,7 @@ import PprCore ( pprCoreExpr )
import Var ( Var, isId, isTyVar )
import VarEnv
import Name ( hashName )
import Literal ( hashLiteral, literalType, litIsDupable, isZeroLit )
import Literal ( hashLiteral, literalType, litIsDupable,
litIsTrivial,
isZeroLit )
import DataCon ( DataCon, dataConRepArity, dataConArgTys, isExistentialDataCon, dataConTyCon )
import PrimOp ( PrimOp(..), primOpOkForSpeculation, primOpIsCheap )
import Id ( Id, idType, globalIdDetails, idNewStrictness,
...
...
@@ -326,7 +326,7 @@ saturating them.
\begin{code}
exprIsTrivial (Var v) = True -- See notes above
exprIsTrivial (Type _) = True
exprIsTrivial (Lit lit) =
True
exprIsTrivial (Lit lit) =
litIsTrivial lit
exprIsTrivial (App e arg) = not (isRuntimeArg arg) && exprIsTrivial e
exprIsTrivial (Note _ e) = exprIsTrivial e
exprIsTrivial (Lam b body) = not (isRuntimeVar b) && exprIsTrivial body
...
...
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