Marge Bot pushed to branch wip/marge_bot_batch_merge_job at Glasgow Haskell Compiler / GHC

Commits:

12 changed files:

Changes:

  • .gitlab/ci.sh
    ... ... @@ -275,7 +275,7 @@ function setup() {
    275 275
     
    
    276 276
     function fetch_ghc() {
    
    277 277
       local should_fetch=false
    
    278
    -  
    
    278
    +
    
    279 279
       if [ ! -e "$GHC" ]; then
    
    280 280
         if [ -z "${FETCH_GHC_VERSION:-}" ]; then
    
    281 281
           fail "GHC not found at '$GHC' and FETCH_GHC_VERSION is not set"
    
    ... ... @@ -292,7 +292,7 @@ function fetch_ghc() {
    292 292
           fi
    
    293 293
         fi
    
    294 294
       fi
    
    295
    -  
    
    295
    +
    
    296 296
       if [ "$should_fetch" = true ]; then
    
    297 297
           local v="$FETCH_GHC_VERSION"
    
    298 298
     
    
    ... ... @@ -887,8 +887,28 @@ function save_cache () {
    887 887
     }
    
    888 888
     
    
    889 889
     function clean() {
    
    890
    -  rm -R tmp
    
    891
    -  run rm -Rf _build
    
    890
    +  # When CI_DISPOSABLE_ENVIRONMENT is not true (e.g. using shell
    
    891
    +  # executor on windows/macos), the project directory is not removed
    
    892
    +  # by gitlab runner automatically after each job. To mitigate the
    
    893
    +  # space leak, other than periodic cleaning on the runner host, we
    
    894
    +  # also must aggressively cleanup build products, otherwise we run
    
    895
    +  # into out of space errors too frequently.
    
    896
    +  #
    
    897
    +  # When CI_DISPOSABLE_ENVIRONMENT is true (using docker executor on
    
    898
    +  # linux), the runner will do proper cleanup, so no need to do
    
    899
    +  # anything here.
    
    900
    +  #
    
    901
    +  # The exclude list are the artifacts that we do expect to be
    
    902
    +  # uploaded. Keep in sync with `jobArtifacts` in
    
    903
    +  # `.gitlab/generate-ci/gen_ci.hs`!
    
    904
    +  if [[ "${CI_DISPOSABLE_ENVIRONMENT:-}" != true ]]; then
    
    905
    +    git submodule foreach --recursive git clean -xdf
    
    906
    +    git clean -xdf \
    
    907
    +      --exclude=ci_timings.txt \
    
    908
    +      --exclude=ghc-*.tar.xz \
    
    909
    +      --exclude=junit.xml \
    
    910
    +      --exclude=unexpected-test-output.tar.gz
    
    911
    +  fi
    
    892 912
     }
    
    893 913
     
    
    894 914
     function run_hadrian() {
    

  • .gitlab/generate-ci/gen_ci.hs
    ... ... @@ -889,6 +889,8 @@ job arch opsys buildConfig = NamedJob { name = jobName, jobInfo = Job {..} }
    889 889
           , if testsuiteUsePerf buildConfig then "RUNTEST_ARGS" =: "--config perf_path=perf" else mempty
    
    890 890
           ]
    
    891 891
     
    
    892
    +    -- Keep in sync with the exclude list in `function clean()` in
    
    893
    +    -- `.gitlab/ci.sh`!
    
    892 894
         jobArtifacts = Artifacts
    
    893 895
           { junitReport = "junit.xml"
    
    894 896
           , expireIn = "2 weeks"
    

  • compiler/GHC/Cmm/Opt.hs
    ... ... @@ -395,26 +395,39 @@ cmmMachOpFoldM platform mop [x, (CmmLit (CmmInt 1 rep))]
    395 395
         one  = CmmLit (CmmInt 1 (wordWidth platform))
    
    396 396
     
    
    397 397
     -- Now look for multiplication/division by powers of 2 (integers).
    
    398
    -
    
    399
    -cmmMachOpFoldM platform mop [x, (CmmLit (CmmInt n _))]
    
    398
    +--
    
    399
    +-- Naively this is as simple a matter as left/right bit shifts,
    
    400
    +-- but the Cmm representation if integral values quickly complicated the matter.
    
    401
    +--
    
    402
    +-- We must carefully narrow the value to be within the range of values for the
    
    403
    +-- type's logical bit-width. However, Cmm only represents values as *signed*
    
    404
    +-- integers internally yet the logical type may be unsigned. If we are dealing
    
    405
    +-- with a negative integer type at width @_w@, the only negative number that
    
    406
    +-- wraps around to be a positive power of 2 after calling narrowU is -2^(_w - 1)
    
    407
    +-- which wraps round to 2^(_w - 1), and multiplying by -2^(_w - 1) is indeed
    
    408
    +-- the same as a left shift by (w - 1), so this is OK.
    
    409
    +--
    
    410
    +-- ToDo: See #25664 (comment 605821) describing a change to the Cmm literal representation.
    
    411
    +-- When/If this is completed, this code must be refactored to account for the explicit width sizes.
    
    412
    +cmmMachOpFoldM platform mop [x, (CmmLit (CmmInt n _w))]
    
    400 413
       = case mop of
    
    401 414
             MO_Mul rep
    
    402
    -           | Just p <- exactLog2 n ->
    
    415
    +           | Just p <- exactLog2 (narrowU rep n) ->
    
    403 416
                      Just $! (cmmMachOpFold platform (MO_Shl rep) [x, CmmLit (CmmInt p $ wordWidth platform)])
    
    404 417
             MO_U_Quot rep
    
    405
    -           | Just p <- exactLog2 n ->
    
    418
    +           | Just p <- exactLog2 (narrowU rep n) ->
    
    406 419
                      Just $! (cmmMachOpFold platform (MO_U_Shr rep) [x, CmmLit (CmmInt p $ wordWidth platform)])
    
    407 420
             MO_U_Rem rep
    
    408
    -           | Just _ <- exactLog2 n ->
    
    421
    +           | Just _ <- exactLog2 (narrowU rep n)  ->
    
    409 422
                      Just $! (cmmMachOpFold platform (MO_And rep) [x, CmmLit (CmmInt (n - 1) rep)])
    
    410 423
             MO_S_Quot rep
    
    411
    -           | Just p <- exactLog2 n,
    
    424
    +           | Just p <- exactLog2 (narrowS rep n),
    
    412 425
                  CmmReg _ <- x ->   -- We duplicate x in signedQuotRemHelper, hence require
    
    413 426
                                     -- it is a reg.  FIXME: remove this restriction.
    
    414 427
                     Just $! (cmmMachOpFold platform (MO_S_Shr rep)
    
    415 428
                       [signedQuotRemHelper rep p, CmmLit (CmmInt p $ wordWidth platform)])
    
    416 429
             MO_S_Rem rep
    
    417
    -           | Just p <- exactLog2 n,
    
    430
    +           | Just p <- exactLog2 (narrowS rep n),
    
    418 431
                  CmmReg _ <- x ->   -- We duplicate x in signedQuotRemHelper, hence require
    
    419 432
                                     -- it is a reg.  FIXME: remove this restriction.
    
    420 433
                     -- We replace (x `rem` 2^p) by (x - (x `quot` 2^p) * 2^p).
    

  • compiler/GHC/Hs/Type.hs
    ... ... @@ -640,6 +640,9 @@ hsLTyVarName = hsTyVarName . unLoc
    640 640
     hsLTyVarNames :: [LHsTyVarBndr flag (GhcPass p)] -> [IdP (GhcPass p)]
    
    641 641
     hsLTyVarNames = mapMaybe hsLTyVarName
    
    642 642
     
    
    643
    +hsQTvExplicit :: LHsQTyVars (GhcPass p) -> [LHsTyVarBndr (HsBndrVis (GhcPass p)) (GhcPass p)]
    
    644
    +hsQTvExplicit = hsq_explicit
    
    645
    +
    
    643 646
     hsForAllTelescopeBndrs :: HsForAllTelescope (GhcPass p) -> [LHsTyVarBndr ForAllTyFlag (GhcPass p)]
    
    644 647
     hsForAllTelescopeBndrs (HsForAllVis   _ bndrs) = map (fmap (setHsTyVarBndrFlag Required)) bndrs
    
    645 648
     hsForAllTelescopeBndrs (HsForAllInvis _ bndrs) = map (fmap (updateHsTyVarBndrFlag Invisible)) bndrs
    

  • compiler/Language/Haskell/Syntax/Type.hs
    ... ... @@ -55,7 +55,6 @@ module Language.Haskell.Syntax.Type (
    55 55
             FieldOcc(..), LFieldOcc,
    
    56 56
     
    
    57 57
             mapHsOuterImplicit,
    
    58
    -        hsQTvExplicit,
    
    59 58
             isHsKindedTyVar
    
    60 59
         ) where
    
    61 60
     
    
    ... ... @@ -68,7 +67,6 @@ import Language.Haskell.Syntax.Specificity
    68 67
     
    
    69 68
     import GHC.Hs.Doc (LHsDoc)
    
    70 69
     import GHC.Data.FastString (FastString)
    
    71
    -import GHC.Utils.Panic( panic )
    
    72 70
     
    
    73 71
     import Data.Data hiding ( Fixity, Prefix, Infix )
    
    74 72
     import Data.Maybe
    
    ... ... @@ -326,10 +324,6 @@ data LHsQTyVars pass -- See Note [HsType binders]
    326 324
         }
    
    327 325
       | XLHsQTyVars !(XXLHsQTyVars pass)
    
    328 326
     
    
    329
    -hsQTvExplicit :: LHsQTyVars pass -> [LHsTyVarBndr (HsBndrVis pass) pass]
    
    330
    -hsQTvExplicit (HsQTvs { hsq_explicit = explicit_tvs }) = explicit_tvs
    
    331
    -hsQTvExplicit (XLHsQTyVars {})                         = panic "hsQTvExplicit"
    
    332
    -
    
    333 327
     ------------------------------------------------
    
    334 328
     --            HsOuterTyVarBndrs
    
    335 329
     -- Used to quantify the outermost type variable binders of a type that obeys
    

  • docs/users_guide/exts/gadt_syntax.rst
    ... ... @@ -387,6 +387,6 @@ type declarations.
    387 387
     
    
    388 388
        ::
    
    389 389
     
    
    390
    -          infix 6 (:--:)
    
    390
    +          infix 6 :--:
    
    391 391
               data T a where
    
    392 392
                 (:--:) :: Int -> Bool -> T Int

  • testsuite/tests/cmm/opt/T25664.hs
    1
    +{-# OPTIONS_GHC -O -fno-full-laziness #-}
    
    2
    +{-# LANGUAGE MagicHash #-}
    
    3
    +
    
    4
    +import GHC.Exts
    
    5
    +import GHC.Int
    
    6
    +
    
    7
    +mb8 :: Int8 -> Int8
    
    8
    +{-# OPAQUE mb8 #-}
    
    9
    +mb8 (I8# i) = I8# (i `quotInt8#` (noinline intToInt8# 128#))
    
    10
    +
    
    11
    +mb16 :: Int16 -> Int16
    
    12
    +{-# OPAQUE mb16 #-}
    
    13
    +mb16 (I16# i) = I16# (i `quotInt16#` (noinline intToInt16# 32768#))
    
    14
    +
    
    15
    +main :: IO ()
    
    16
    +main = print (mb8 minBound) >> print (mb16 minBound)
    
    17
    +

  • testsuite/tests/cmm/opt/T25664.stdout
    1
    +1
    
    2
    +1

  • testsuite/tests/cmm/opt/all.T
    ... ... @@ -12,3 +12,6 @@ test('T25771', [cmm_src, only_ways(['optasm']),
    12 12
                     grep_errmsg(r'(12\.345|0\.6640625)',[1]),
    
    13 13
                     ],
    
    14 14
          compile, ['-ddump-cmm'])
    
    15
    +
    
    16
    +# Cmm should correctly account for word size when performing MUL/DIV/REM by a power of 2 optimization.
    
    17
    +test('T25664', normal, compile_and_run, [''])
    \ No newline at end of file

  • utils/haddock/haddock-api/src/Haddock/Backends/LaTeX.hs
    ... ... @@ -435,7 +435,7 @@ ppFamHeader
    435 435
             | associated = id
    
    436 436
             | otherwise = (<+> keyword "family")
    
    437 437
     
    
    438
    -      famName = ppAppDocNameTyVarBndrs unicode name (hsq_explicit tvs)
    
    438
    +      famName = ppAppDocNameTyVarBndrs unicode name (hsQTvExplicitBinders tvs)
    
    439 439
     
    
    440 440
           famSig = case result of
    
    441 441
             NoSig _ -> empty
    
    ... ... @@ -644,7 +644,7 @@ ppTyVars :: RenderableBndrFlag flag => Bool -> [LHsTyVarBndr flag DocNameI] -> [
    644 644
     ppTyVars unicode tvs = map (ppHsTyVarBndr unicode . unLoc) tvs
    
    645 645
     
    
    646 646
     tyvarNames :: LHsQTyVars DocNameI -> [Maybe Name]
    
    647
    -tyvarNames = map (fmap getName . hsLTyVarNameI) . hsQTvExplicit
    
    647
    +tyvarNames = map (fmap getName . hsLTyVarNameI) . hsQTvExplicitBinders
    
    648 648
     
    
    649 649
     declWithDoc :: LaTeX -> Maybe LaTeX -> LaTeX
    
    650 650
     declWithDoc decl doc =
    

  • utils/haddock/haddock-api/src/Haddock/Backends/Xhtml/Decl.hs
    ... ... @@ -468,7 +468,7 @@ ppTySyn
    468 468
           hdr =
    
    469 469
             hsep
    
    470 470
               ( [keyword "type", ppBinder summary occ]
    
    471
    -              ++ ppTyVars unicode qual (hsQTvExplicit ltyvars)
    
    471
    +              ++ ppTyVars unicode qual (hsQTvExplicitBinders ltyvars)
    
    472 472
               )
    
    473 473
           full = hdr <+> def
    
    474 474
           def = case unLoc ltype of
    
    ... ... @@ -595,7 +595,7 @@ ppFamHeader
    595 595
       qual =
    
    596 596
         hsep
    
    597 597
           [ ppFamilyLeader associated info
    
    598
    -      , ppAppDocNameTyVarBndrs summary unicode qual name (hsq_explicit tvs)
    
    598
    +      , ppAppDocNameTyVarBndrs summary unicode qual name (hsQTvExplicitBinders tvs)
    
    599 599
           , ppResultSig result unicode qual
    
    600 600
           , injAnn
    
    601 601
           , whereBit
    
    ... ... @@ -760,7 +760,7 @@ ppClassHdr
    760 760
     ppClassHdr summ lctxt n tvs fds unicode qual =
    
    761 761
       keyword "class"
    
    762 762
         <+> (if not (null $ fromMaybeContext lctxt) then ppLContext lctxt unicode qual HideEmptyContexts else noHtml)
    
    763
    -    <+> ppAppDocNameTyVarBndrs summ unicode qual n (hsQTvExplicit tvs)
    
    763
    +    <+> ppAppDocNameTyVarBndrs summ unicode qual n (hsQTvExplicitBinders tvs)
    
    764 764
         <+> ppFds fds unicode qual
    
    765 765
     
    
    766 766
     ppFds :: [LHsFunDep DocNameI] -> Unicode -> Qualification -> Html
    
    ... ... @@ -1656,7 +1656,7 @@ ppDataHeader
    1656 1656
           ppLContext ctxt unicode qual HideEmptyContexts
    
    1657 1657
           <+>
    
    1658 1658
           -- T a b c ..., or a :+: b
    
    1659
    -      ppAppDocNameTyVarBndrs summary unicode qual name (hsQTvExplicit tvs)
    
    1659
    +      ppAppDocNameTyVarBndrs summary unicode qual name (hsQTvExplicitBinders tvs)
    
    1660 1660
           <+> case ks of
    
    1661 1661
             Nothing -> mempty
    
    1662 1662
             Just (L _ x) -> dcolon unicode <+> ppKind unicode qual x
    

  • utils/haddock/haddock-api/src/Haddock/GhcUtils.hs
    ... ... @@ -333,9 +333,12 @@ lHsQTyVarsToTypes tvs =
    333 333
       [ HsValArg noExtField $ noLocA (case hsLTyVarName tv of
    
    334 334
           Nothing -> HsWildCardTy noExtField
    
    335 335
           Just nm -> HsTyVar noAnn NotPromoted (noLocA $ noUserRdr nm))
    
    336
    -  | tv <- hsQTvExplicit tvs
    
    336
    +  | tv <- hsq_explicit tvs
    
    337 337
       ]
    
    338 338
     
    
    339
    +hsQTvExplicitBinders :: LHsQTyVars DocNameI -> [LHsTyVarBndr (HsBndrVis DocNameI) DocNameI]
    
    340
    +hsQTvExplicitBinders = hsq_explicit
    
    341
    +
    
    339 342
     --------------------------------------------------------------------------------
    
    340 343
     
    
    341 344
     -- * Making abstract declarations