summaryrefslogtreecommitdiff
path: root/compiler/codeGen/StgCmmCon.hs
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/codeGen/StgCmmCon.hs')
-rw-r--r--compiler/codeGen/StgCmmCon.hs14
1 files changed, 6 insertions, 8 deletions
diff --git a/compiler/codeGen/StgCmmCon.hs b/compiler/codeGen/StgCmmCon.hs
index 2ddeceb825..258896ff1a 100644
--- a/compiler/codeGen/StgCmmCon.hs
+++ b/compiler/codeGen/StgCmmCon.hs
@@ -272,14 +272,12 @@ bindConArgs (DataAlt con) base args
-- when accessing the constructor field.
bind_arg :: (NonVoid Id, ByteOff) -> FCode (Maybe LocalReg)
bind_arg (arg@(NonVoid b), offset)
- | isDeadBinder b =
- -- Do not load unused fields from objects to local variables.
- -- (CmmSink can optimize this, but it's cheap and common enough
- -- to handle here)
- return Nothing
- | otherwise = do
- emit $ mkTaggedObjectLoad dflags (idToReg dflags arg) base offset tag
- Just <$> bindArgToReg arg
+ | isDeadBinder b -- See Note [Dead-binder optimisation] in StgCmmExpr
+ = return Nothing
+ | otherwise
+ = do { emit $ mkTaggedObjectLoad dflags (idToReg dflags arg)
+ base offset tag
+ ; Just <$> bindArgToReg arg }
mapMaybeM bind_arg args_w_offsets