diff options
author | Ben Gamari <ben@smart-cactus.org> | 2019-07-09 15:19:30 -0400 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2019-07-09 15:19:30 -0400 |
commit | f8a2f3055763c47c6d89eb023a1b0a0d52937a56 (patch) | |
tree | 73406be7fd1b7c2211d8c3c1fc49bd2e9f92cfff | |
parent | eed09de6d3f22348e0d6a2c17667559d77c01455 (diff) | |
download | haskell-f8a2f3055763c47c6d89eb023a1b0a0d52937a56.tar.gz |
Fix it
-rw-r--r-- | compiler/codeGen/StgCmmPrim.hs | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/compiler/codeGen/StgCmmPrim.hs b/compiler/codeGen/StgCmmPrim.hs index d59e71eb73..6459b68416 100644 --- a/compiler/codeGen/StgCmmPrim.hs +++ b/compiler/codeGen/StgCmmPrim.hs @@ -2252,25 +2252,26 @@ emitCopySmallArray :: (CmmExpr -> CmmExpr -> CmmExpr -> CmmExpr -> ByteOff -> CmmExpr -- ^ offset in destination array -> WordOff -- ^ number of elements to copy -> FCode () -emitCopySmallArray copy src0 src_off dst0 dst_off n = do - dflags <- getDynFlags +emitCopySmallArray copy src0 src_off dst0 dst_off n = + when (n /= 0) $ do + dflags <- getDynFlags - -- Passed as arguments (be careful) - src <- assignTempE src0 - dst <- assignTempE dst0 + -- Passed as arguments (be careful) + src <- assignTempE src0 + dst <- assignTempE dst0 emitCopyUpdRemSetPush dflags (smallArrPtrsHdrSizeW dflags) dst dst_off n - -- Set the dirty bit in the header. - emit (setInfo dst (CmmLit (CmmLabel mkSMAP_DIRTY_infoLabel))) + -- Set the dirty bit in the header. + emit (setInfo dst (CmmLit (CmmLabel mkSMAP_DIRTY_infoLabel))) - dst_p <- assignTempE $ cmmOffsetExprW dflags - (cmmOffsetB dflags dst (smallArrPtrsHdrSize dflags)) dst_off - src_p <- assignTempE $ cmmOffsetExprW dflags - (cmmOffsetB dflags src (smallArrPtrsHdrSize dflags)) src_off - let bytes = wordsToBytes dflags n + dst_p <- assignTempE $ cmmOffsetExprW dflags + (cmmOffsetB dflags dst (smallArrPtrsHdrSize dflags)) dst_off + src_p <- assignTempE $ cmmOffsetExprW dflags + (cmmOffsetB dflags src (smallArrPtrsHdrSize dflags)) src_off + let bytes = wordsToBytes dflags n - copy src dst dst_p src_p bytes + copy src dst dst_p src_p bytes -- | Takes an info table label, a register to return the newly -- allocated array in, a source array, an offset in the source array, |