summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoachim Breitner <mail@joachim-breitner.de>2016-07-05 10:33:09 +0200
committerJoachim Breitner <mail@joachim-breitner.de>2016-07-05 10:33:09 +0200
commit83995cb2e1d0e7125cb10d4202ad26da6541a042 (patch)
treea2abc10fe6461e96eece00af3972453ea9175ef0
parent1c24ab8add3ac4d47eba2c5efeeaaf3d282e15b3 (diff)
downloadhaskell-83995cb2e1d0e7125cb10d4202ad26da6541a042.tar.gz
Do not optimize UData [[Abs],[Abs]] to UHeadwip/T12364
as the "constructor tag" is, in a way, a used component.
-rw-r--r--compiler/basicTypes/Demand.hs9
1 files changed, 6 insertions, 3 deletions
diff --git a/compiler/basicTypes/Demand.hs b/compiler/basicTypes/Demand.hs
index 07fb39a38f..3ee02f109d 100644
--- a/compiler/basicTypes/Demand.hs
+++ b/compiler/basicTypes/Demand.hs
@@ -389,9 +389,12 @@ mkUCall :: Count -> UseDmd -> UseDmd
mkUCall c a = UCall c a
mkUData :: [[ArgUse]] -> UseDmd
-mkUData ux
- | all (all (== Abs)) ux = UHead
- | otherwise = UData ux
+mkUData [ux] | all (== Abs) ux = UHead
+ -- Sum types are not UHead (which is assumed to be the demand type of a seq),
+ -- As although the components may possibly not be used, the information _which_
+ -- constructor is used is important.
+mkUData uss | all null uss = Used
+mkUData uss = UData uss
lubCount :: Count -> Count -> Count
lubCount _ Many = Many