[GHC] #13338: New versions of time and Cabal are causing a Core Lint error on Windows
#13338: New versions of time and Cabal are causing a Core Lint error on Windows -------------------------------------+------------------------------------- Reporter: rwbarton | Owner: (none) Type: bug | Status: new Priority: highest | Milestone: 8.2.1 Component: Compiler | Version: 8.1 Keywords: | Operating System: Unknown/Multiple Architecture: | Type of failure: None/Unknown Unknown/Multiple | Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- Commit c8d995db5d743358b0583fe97f8113bf9047641e in ghc bumped the `time` submodule to the latest version 4eb06c0e (`time-1.8`). But it caused a Core Lint error while compiling `Distribution.Compat.Time`, in the Cabal library: {{{ *** Core Lint errors : in result of Float out(FOS {Lam = Just 0, Consts = True, OverSatApps = True}) *** <no location info>: warning: In the expression: $wsystemToUTCTime (case lvl_sdDL of v_B1 { I# v_B2 -> v_B2 }) (case lvl_sdDM of v_B1 { W# v_B2 -> v_B2 }) This argument does not satisfy the let/app invariant: case lvl_sdDL of v_B1 { I# v_B2 -> v_B2 } }}} See https://phabricator.haskell.org/harbormaster/build/21371/ for the full build log. For now the submodule bumps have been reverted. -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13338> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#13338: New versions of time and Cabal are causing a Core Lint error on Windows -------------------------------------+------------------------------------- Reporter: rwbarton | Owner: rwbarton Type: bug | Status: new Priority: highest | Milestone: 8.2.1 Component: Compiler | Version: 8.1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by rwbarton): * owner: (none) => rwbarton -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13338#comment:1> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#13338: New versions of time and Cabal are causing a Core Lint error on Windows -------------------------------------+------------------------------------- Reporter: rwbarton | Owner: rwbarton Type: bug | Status: new Priority: highest | Milestone: 8.2.1 Component: Compiler | Version: 8.1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by rwbarton): I'm assuming this occurs only on Windows just because of lots of `#if defined mingw32_HOST_OS` in time and/or Cabal, and isn't Windows-specific in any more serious way. -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13338#comment:2> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#13338: New versions of time and Cabal are causing a Core Lint error on Windows -------------------------------------+------------------------------------- Reporter: rwbarton | Owner: (none) Type: bug | Status: new Priority: highest | Milestone: 8.2.1 Component: Compiler | Version: 8.1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by rwbarton): * owner: rwbarton => (none) * cc: simonpj (added) Comment: Here is a self-contained reproducer with today's HEAD: {{{#!hs {-# LANGUAGE MagicHash #-} module Fl2 where import GHC.Exts magic# :: Int# -> Bool magic# x# = True {-# NOINLINE magic# #-} f :: Int# -> Int -> Int f x# n = length [ i | i@(I# i#) <- [0..n], magic# (remInt# x# 100000# -# i#) ] }}} When the expression `remInt# x# 100000#` gets floated out of the loop and replaced by {{{ case lvl_s2Tb of v_B1 { I# v_B2 -> v_B2 } }}} the surrounding application {{{ -# (case lvl_s2Tb of v_B1 { I# v_B2 -> v_B2 }) i#_a1ok }}} does not satisfy the let/app invariant. Interestingly my build of the "Join points" commit (Feb 1) does not float out the expression `remInt# x# 100000#`. That's a bit curious since it already contains the commit "Float unboxed expressions by boxing". So my guess is that one of "Another improvement to SetLevels" and "Fix SetLevels for join points" is responsible. -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13338#comment:3> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#13338: New versions of time and Cabal are causing a Core Lint error on Windows -------------------------------------+------------------------------------- Reporter: rwbarton | Owner: (none) Type: bug | Status: new Priority: highest | Milestone: 8.2.1 Component: Compiler | Version: 8.1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by rwbarton): I was trying to figure out how to avoid doing the floating out when the result would violate the let/app invariant, or possibly how to have `exprOkForSpeculation` look through the binding created by floating out, but hang on: if the expression was originally okay for speculation, then can't we just float it out as an unboxed value? That would be more efficient too. If we only ever do the boxing transformation to things that were not originally okay for speculation, then I think we can't break the let/app invariant. -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13338#comment:4> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#13338: New versions of time and Cabal are causing a Core Lint error on Windows -------------------------------------+------------------------------------- Reporter: rwbarton | Owner: (none) Type: bug | Status: patch Priority: highest | Milestone: 8.2.1 Component: Compiler | Version: 8.1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: | simplCore/should_compile/T13338 Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D3217 Wiki Page: | -------------------------------------+------------------------------------- Changes (by rwbarton): * status: new => patch * testcase: => simplCore/should_compile/T13338 * differential: => Phab:D3217 -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13338#comment:5> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#13338: New versions of time and Cabal are causing a Core Lint error on Windows -------------------------------------+------------------------------------- Reporter: rwbarton | Owner: (none) Type: bug | Status: patch Priority: highest | Milestone: 8.2.1 Component: Compiler | Version: 8.1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: | simplCore/should_compile/T13338 Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D3217 Wiki Page: | -------------------------------------+------------------------------------- Comment (by simonpj): You are very fast! I tripped across exactly this last week and have a patch in validation. Stay tuned. Simon -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13338#comment:6> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#13338: New versions of time and Cabal are causing a Core Lint error on Windows -------------------------------------+------------------------------------- Reporter: rwbarton | Owner: (none) Type: bug | Status: patch Priority: highest | Milestone: 8.2.1 Component: Compiler | Version: 8.1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: | simplCore/should_compile/T13338 Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D3217 Wiki Page: | -------------------------------------+------------------------------------- Comment (by simonpj): Ah you'd made more progress than I thought. I've commented on Phab:D3217. Over to you! -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13338#comment:7> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#13338: New versions of time and Cabal are causing a Core Lint error on Windows -------------------------------------+------------------------------------- Reporter: rwbarton | Owner: (none) Type: bug | Status: patch Priority: highest | Milestone: 8.2.1 Component: Compiler | Version: 8.1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: | simplCore/should_compile/T13338 Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D3217 Wiki Page: | -------------------------------------+------------------------------------- Comment (by Ben Gamari <ben@…>): In [changeset:"d0508ef001e9c93920f6eb066cab5e79041cb886/ghc" d0508ef/ghc]: {{{ #!CommitTicketReference repository="ghc" revision="d0508ef001e9c93920f6eb066cab5e79041cb886" When floating, don't box an expression that's okay for speculation (#13338) Commit 432f952e (Float unboxed expressions by boxing) lets the float-out pass turn, for example, ... (-# (remInt# x# 100000#) i#) ... into let lvl :: Int lvl = case remInt# x# 100000# of v { __DEFAULT__ -> I# v } in ... (-# (case lvl of { I# v -> v }) i#) ... But when, as in the example above, the expression that was floated out was the argument of an application, the resulting application may no longer satisfy the let/app invariant, because exprOkForSpeculation doesn't look far enough inside the definition of lvl. Solution: When the expression we floated out was okay for speculation, don't bother boxing it. It will be evaluated earlier, and that's okay by assumption. Fixes the let/app invariant and is cheaper too. Test Plan: make slowtest TEST=T13338 Reviewers: austin, bgamari, simonpj Reviewed By: bgamari, simonpj Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D3217 }}} -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13338#comment:8> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#13338: New versions of time and Cabal are causing a Core Lint error on Windows -------------------------------------+------------------------------------- Reporter: rwbarton | Owner: (none) Type: bug | Status: closed Priority: highest | Milestone: 8.2.1 Component: Compiler | Version: 8.1 Resolution: fixed | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: | simplCore/should_compile/T13338 Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D3217 Wiki Page: | -------------------------------------+------------------------------------- Changes (by bgamari): * status: patch => closed * resolution: => fixed -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13338#comment:9> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
participants (1)
-
GHC