summaryrefslogtreecommitdiff
path: root/compiler/coreSyn/CoreUtils.hs
diff options
context:
space:
mode:
authorBen Gamari <bgamari.foss@gmail.com>2017-03-19 11:53:01 -0400
committerBen Gamari <ben@smart-cactus.org>2018-02-04 00:02:33 -0500
commit260f547fda14842b8891f365e3dba3ba234b6edc (patch)
tree70eeab91a05e9f4d97a54821452f2da9ddda4cac /compiler/coreSyn/CoreUtils.hs
parent1b442ed42b875cfc0b75ff0e8e431e671be071f8 (diff)
downloadhaskell-wip/libdw-prof.tar.gz
Never tick primitive string literalswip/libdw-prof
This is a more aggressive approach to the problem initially solved in f5b275a239d2554c4da0b7621211642bf3b10650, where top-level primitive string literals were being wrapped by ticks. This breaks the Core invariant descirbed in Note [CoreSyn top-level string literals]. However, the previous approach was incomplete and left several places where inappropriate ticks could sneak in. This commit kills the problem at the source: we simply never tick any primitive string literal expression. The assumption here is that these expressions are destined for the top-level, where they cannot be ticked, anyways. So even if they haven't been floated out yet there is no reason to tick them. This partially reverts commit f5b275a239d2554c4da0b7621211642bf3b10650. Test Plan: Validate with `-g` Reviewers: austin, scpmw, simonpj, simonmar, dfeuer Subscribers: dfeuer, simonmar, thomie Differential Revision: https://phabricator.haskell.org/D3063
Diffstat (limited to 'compiler/coreSyn/CoreUtils.hs')
-rw-r--r--compiler/coreSyn/CoreUtils.hs5
1 files changed, 5 insertions, 0 deletions
diff --git a/compiler/coreSyn/CoreUtils.hs b/compiler/coreSyn/CoreUtils.hs
index 3d5f4bcb5a..ca67e24ca3 100644
--- a/compiler/coreSyn/CoreUtils.hs
+++ b/compiler/coreSyn/CoreUtils.hs
@@ -305,6 +305,11 @@ mkTick t orig_expr = mkTick' id id orig_expr
-> CoreExpr
mkTick' top rest expr = case expr of
+ -- Never tick primitive string literals. These should ultimately float up to
+ -- the top-level where they must be unadorned. See Note
+ -- [CoreSyn top-level string literals] for details.
+ _ | exprIsLiteralString expr -> expr
+
-- Cost centre ticks should never be reordered relative to each
-- other. Therefore we can stop whenever two collide.
Tick t2 e