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

Commits:

28 changed files:

Changes:

  • .gitlab-ci.yml
    ... ... @@ -62,6 +62,11 @@ variables:
    62 62
       XZ_OPT: "-1"
    
    63 63
     default:
    
    64 64
       interruptible: true
    
    65
    +  retry:
    
    66
    +    max: 2
    
    67
    +    when:
    
    68
    +      - runner_system_failure
    
    69
    +      - stuck_or_timeout_failure
    
    65 70
     
    
    66 71
     stages:
    
    67 72
       - not-interruptible
    
    ... ... @@ -113,7 +118,7 @@ workflow:
    113 118
         # cause a duplicate pipeline for merge requests coming from the master
    
    114 119
         # branch of a fork.
    
    115 120
         - if: $CI_PROJECT_ID == "1" && $CI_COMMIT_BRANCH == "master"
    
    116
    -    - if: $CI_PROJECT_ID == "1" && $CI_COMMIT_BRANCH =~ /ghc-[0-9]+\.[0-9]+/
    
    121
    +    - if: $CI_PROJECT_ID == "1" && $CI_COMMIT_BRANCH =~ /^ghc-[0-9]+\.[0-9]+$/
    
    117 122
         - if: '$CI_PIPELINE_SOURCE == "web"'
    
    118 123
     
    
    119 124
     # which versions of GHC to allow bootstrap with
    
    ... ... @@ -193,7 +198,7 @@ workflow:
    193 198
       - if: '$CI_MERGE_REQUEST_LABELS =~ /.*full-ci.*/'
    
    194 199
       - if: '$CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/'
    
    195 200
       - if: '$CI_COMMIT_BRANCH == "master"'
    
    196
    -  - if: '$CI_COMMIT_BRANCH =~ /ghc-[0-9]+\.[0-9]+/'
    
    201
    +  - if: '$CI_COMMIT_BRANCH =~ /^ghc-[0-9]+\.[0-9]+$/'
    
    197 202
     
    
    198 203
     ############################################################
    
    199 204
     # Runner Tags
    
    ... ... @@ -415,7 +420,7 @@ lint-submods-branch:
    415 420
         - _build/stageBoot/bin/lint-submodule-refs . $(git rev-list $CI_COMMIT_BEFORE_SHA..$CI_COMMIT_SHA)
    
    416 421
       rules:
    
    417 422
         - if: '$CI_COMMIT_BRANCH == "master"'
    
    418
    -    - if: '$CI_COMMIT_BRANCH =~ /ghc-[0.9]+\.[0-9]+/'
    
    423
    +    - if: '$CI_COMMIT_BRANCH =~ /^ghc-[0-9]+\.[0-9]+$/'
    
    419 424
         - *drafts-can-fail-lint
    
    420 425
     
    
    421 426
     ############################################################
    

  • .gitlab/ci.sh
    ... ... @@ -496,7 +496,7 @@ function fetch_perf_notes() {
    496 496
     }
    
    497 497
     
    
    498 498
     function push_perf_notes() {
    
    499
    -  if [[ "${CI_COMMIT_BRANCH:-}" != "master" ]] && [[ ! "${CI_COMMIT_BRANCH:-}" =~ ghc-[0-9]+\.[0-9]+ ]]; then
    
    499
    +  if [[ "${CI_COMMIT_BRANCH:-}" != "master" ]] && [[ ! "${CI_COMMIT_BRANCH:-}" =~ ^ghc-[0-9]+\.[0-9]+$ ]]; then
    
    500 500
         info "Perf notes are only pushed on master/release branches"
    
    501 501
         return
    
    502 502
       fi
    

  • .gitlab/generate-ci/gen_ci.hs
    ... ... @@ -870,7 +870,7 @@ validateRuleString :: ValidateRule -> Cond
    870 870
     validateRuleString FullCI       = or_all [ labelString "full-ci"
    
    871 871
                                              , labelString "marge_bot_batch_merge_job"
    
    872 872
                                              , branchStringExact "master"
    
    873
    -                                         , branchStringLike "ghc-[0-9]+\\.[0-9]+"
    
    873
    +                                         , branchStringLike "^ghc-[0-9]+\\.[0-9]+$"
    
    874 874
                                              ]
    
    875 875
     validateRuleString FastCI       = true
    
    876 876
     
    

  • .gitlab/jobs.yaml
    ... ... @@ -538,7 +538,7 @@
    538 538
         ],
    
    539 539
         "rules": [
    
    540 540
           {
    
    541
    -        "if": "((($ONLY_JOBS) && ($ONLY_JOBS =~ /.*\\baarch64-linux-deb12-wine-int_native-cross_aarch64-unknown-mingw32-validate(\\s|$).*/)) || (($ONLY_JOBS == null) && ((($CI_MERGE_REQUEST_LABELS =~ /.*full-ci.*/) || ($CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/) || ($CI_COMMIT_BRANCH == \"master\") || ($CI_COMMIT_BRANCH =~ /ghc-[0-9]+\\.[0-9]+/)) || (($CI_MERGE_REQUEST_LABELS =~ /.*aarch64.*/) && ($CI_MERGE_REQUEST_LABELS =~ /.*Windows.*/))))) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)",
    
    541
    +        "if": "((($ONLY_JOBS) && ($ONLY_JOBS =~ /.*\\baarch64-linux-deb12-wine-int_native-cross_aarch64-unknown-mingw32-validate(\\s|$).*/)) || (($ONLY_JOBS == null) && ((($CI_MERGE_REQUEST_LABELS =~ /.*full-ci.*/) || ($CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/) || ($CI_COMMIT_BRANCH == \"master\") || ($CI_COMMIT_BRANCH =~ /^ghc-[0-9]+\\.[0-9]+$/)) || (($CI_MERGE_REQUEST_LABELS =~ /.*aarch64.*/) && ($CI_MERGE_REQUEST_LABELS =~ /.*Windows.*/))))) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)",
    
    542 542
             "when": "on_success"
    
    543 543
           }
    
    544 544
         ],
    
    ... ... @@ -622,7 +622,7 @@
    622 622
         ],
    
    623 623
         "rules": [
    
    624 624
           {
    
    625
    -        "if": "((($ONLY_JOBS) && ($ONLY_JOBS =~ /.*\\baarch64-linux-deb12-wine-int_native-cross_aarch64-unknown-mingw32-validate\\+llvm(\\s|$).*/)) || (($ONLY_JOBS == null) && ((($CI_MERGE_REQUEST_LABELS =~ /.*full-ci.*/) || ($CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/) || ($CI_COMMIT_BRANCH == \"master\") || ($CI_COMMIT_BRANCH =~ /ghc-[0-9]+\\.[0-9]+/)) || (($CI_MERGE_REQUEST_LABELS =~ /.*aarch64.*/) && ($CI_MERGE_REQUEST_LABELS =~ /.*Windows.*/) && ($CI_MERGE_REQUEST_LABELS =~ /.*LLVM backend.*/))))) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)",
    
    625
    +        "if": "((($ONLY_JOBS) && ($ONLY_JOBS =~ /.*\\baarch64-linux-deb12-wine-int_native-cross_aarch64-unknown-mingw32-validate\\+llvm(\\s|$).*/)) || (($ONLY_JOBS == null) && ((($CI_MERGE_REQUEST_LABELS =~ /.*full-ci.*/) || ($CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/) || ($CI_COMMIT_BRANCH == \"master\") || ($CI_COMMIT_BRANCH =~ /^ghc-[0-9]+\\.[0-9]+$/)) || (($CI_MERGE_REQUEST_LABELS =~ /.*aarch64.*/) && ($CI_MERGE_REQUEST_LABELS =~ /.*Windows.*/) && ($CI_MERGE_REQUEST_LABELS =~ /.*LLVM backend.*/))))) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)",
    
    626 626
             "when": "on_success"
    
    627 627
           }
    
    628 628
         ],
    
    ... ... @@ -952,7 +952,7 @@
    952 952
         ],
    
    953 953
         "rules": [
    
    954 954
           {
    
    955
    -        "if": "((($ONLY_JOBS) && ($ONLY_JOBS =~ /.*\\bi386-linux-alpine3_23-validate(\\s|$).*/)) || (($ONLY_JOBS == null) && ((($CI_MERGE_REQUEST_LABELS =~ /.*full-ci.*/) || ($CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/) || ($CI_COMMIT_BRANCH == \"master\") || ($CI_COMMIT_BRANCH =~ /ghc-[0-9]+\\.[0-9]+/))))) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)",
    
    955
    +        "if": "((($ONLY_JOBS) && ($ONLY_JOBS =~ /.*\\bi386-linux-alpine3_23-validate(\\s|$).*/)) || (($ONLY_JOBS == null) && ((($CI_MERGE_REQUEST_LABELS =~ /.*full-ci.*/) || ($CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/) || ($CI_COMMIT_BRANCH == \"master\") || ($CI_COMMIT_BRANCH =~ /^ghc-[0-9]+\\.[0-9]+$/))))) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)",
    
    956 956
             "when": "on_success"
    
    957 957
           }
    
    958 958
         ],
    
    ... ... @@ -1014,7 +1014,7 @@
    1014 1014
         ],
    
    1015 1015
         "rules": [
    
    1016 1016
           {
    
    1017
    -        "if": "((($ONLY_JOBS) && ($ONLY_JOBS =~ /.*\\bi386-linux-alpine3_23-validate(\\s|$).*/)) || (($ONLY_JOBS == null) && ((($CI_MERGE_REQUEST_LABELS =~ /.*full-ci.*/) || ($CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/) || ($CI_COMMIT_BRANCH == \"master\") || ($CI_COMMIT_BRANCH =~ /ghc-[0-9]+\\.[0-9]+/))))) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)",
    
    1017
    +        "if": "((($ONLY_JOBS) && ($ONLY_JOBS =~ /.*\\bi386-linux-alpine3_23-validate(\\s|$).*/)) || (($ONLY_JOBS == null) && ((($CI_MERGE_REQUEST_LABELS =~ /.*full-ci.*/) || ($CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/) || ($CI_COMMIT_BRANCH == \"master\") || ($CI_COMMIT_BRANCH =~ /^ghc-[0-9]+\\.[0-9]+$/))))) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)",
    
    1018 1018
             "when": "on_success"
    
    1019 1019
           }
    
    1020 1020
         ],
    
    ... ... @@ -1323,7 +1323,7 @@
    1323 1323
         ],
    
    1324 1324
         "rules": [
    
    1325 1325
           {
    
    1326
    -        "if": "((($ONLY_JOBS) && ($ONLY_JOBS =~ /.*\\bi386-linux-deb13-validate(\\s|$).*/)) || (($ONLY_JOBS == null) && ((($CI_MERGE_REQUEST_LABELS =~ /.*full-ci.*/) || ($CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/) || ($CI_COMMIT_BRANCH == \"master\") || ($CI_COMMIT_BRANCH =~ /ghc-[0-9]+\\.[0-9]+/)) || ($CI_MERGE_REQUEST_LABELS =~ /.*i386.*/)))) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)",
    
    1326
    +        "if": "((($ONLY_JOBS) && ($ONLY_JOBS =~ /.*\\bi386-linux-deb13-validate(\\s|$).*/)) || (($ONLY_JOBS == null) && ((($CI_MERGE_REQUEST_LABELS =~ /.*full-ci.*/) || ($CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/) || ($CI_COMMIT_BRANCH == \"master\") || ($CI_COMMIT_BRANCH =~ /^ghc-[0-9]+\\.[0-9]+$/)) || ($CI_MERGE_REQUEST_LABELS =~ /.*i386.*/)))) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)",
    
    1327 1327
             "when": "on_success"
    
    1328 1328
           }
    
    1329 1329
         ],
    
    ... ... @@ -1384,7 +1384,7 @@
    1384 1384
         ],
    
    1385 1385
         "rules": [
    
    1386 1386
           {
    
    1387
    -        "if": "((($ONLY_JOBS) && ($ONLY_JOBS =~ /.*\\bi386-linux-deb13-validate(\\s|$).*/)) || (($ONLY_JOBS == null) && ((($CI_MERGE_REQUEST_LABELS =~ /.*full-ci.*/) || ($CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/) || ($CI_COMMIT_BRANCH == \"master\") || ($CI_COMMIT_BRANCH =~ /ghc-[0-9]+\\.[0-9]+/)) || ($CI_MERGE_REQUEST_LABELS =~ /.*i386.*/)))) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)",
    
    1387
    +        "if": "((($ONLY_JOBS) && ($ONLY_JOBS =~ /.*\\bi386-linux-deb13-validate(\\s|$).*/)) || (($ONLY_JOBS == null) && ((($CI_MERGE_REQUEST_LABELS =~ /.*full-ci.*/) || ($CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/) || ($CI_COMMIT_BRANCH == \"master\") || ($CI_COMMIT_BRANCH =~ /^ghc-[0-9]+\\.[0-9]+$/)) || ($CI_MERGE_REQUEST_LABELS =~ /.*i386.*/)))) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)",
    
    1388 1388
             "when": "on_success"
    
    1389 1389
           }
    
    1390 1390
         ],
    
    ... ... @@ -10542,7 +10542,7 @@
    10542 10542
         ],
    
    10543 10543
         "rules": [
    
    10544 10544
           {
    
    10545
    -        "if": "((($ONLY_JOBS) && ($ONLY_JOBS =~ /.*\\bx86_64-darwin-validate(\\s|$).*/)) || (($ONLY_JOBS == null) && ((($CI_MERGE_REQUEST_LABELS =~ /.*full-ci.*/) || ($CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/) || ($CI_COMMIT_BRANCH == \"master\") || ($CI_COMMIT_BRANCH =~ /ghc-[0-9]+\\.[0-9]+/)) || ($CI_MERGE_REQUEST_LABELS =~ /.*test-primops.*/)))) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)",
    
    10545
    +        "if": "((($ONLY_JOBS) && ($ONLY_JOBS =~ /.*\\bx86_64-darwin-validate(\\s|$).*/)) || (($ONLY_JOBS == null) && ((($CI_MERGE_REQUEST_LABELS =~ /.*full-ci.*/) || ($CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/) || ($CI_COMMIT_BRANCH == \"master\") || ($CI_COMMIT_BRANCH =~ /^ghc-[0-9]+\\.[0-9]+$/)) || ($CI_MERGE_REQUEST_LABELS =~ /.*test-primops.*/)))) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)",
    
    10546 10546
             "when": "on_success"
    
    10547 10547
           }
    
    10548 10548
         ],
    
    ... ... @@ -10610,7 +10610,7 @@
    10610 10610
         ],
    
    10611 10611
         "rules": [
    
    10612 10612
           {
    
    10613
    -        "if": "((($ONLY_JOBS) && ($ONLY_JOBS =~ /.*\\bx86_64-darwin-validate(\\s|$).*/)) || (($ONLY_JOBS == null) && ((($CI_MERGE_REQUEST_LABELS =~ /.*full-ci.*/) || ($CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/) || ($CI_COMMIT_BRANCH == \"master\") || ($CI_COMMIT_BRANCH =~ /ghc-[0-9]+\\.[0-9]+/)) || ($CI_MERGE_REQUEST_LABELS =~ /.*test-primops.*/)))) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)",
    
    10613
    +        "if": "((($ONLY_JOBS) && ($ONLY_JOBS =~ /.*\\bx86_64-darwin-validate(\\s|$).*/)) || (($ONLY_JOBS == null) && ((($CI_MERGE_REQUEST_LABELS =~ /.*full-ci.*/) || ($CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/) || ($CI_COMMIT_BRANCH == \"master\") || ($CI_COMMIT_BRANCH =~ /^ghc-[0-9]+\\.[0-9]+$/)) || ($CI_MERGE_REQUEST_LABELS =~ /.*test-primops.*/)))) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)",
    
    10614 10614
             "when": "on_success"
    
    10615 10615
           }
    
    10616 10616
         ],
    
    ... ... @@ -10678,7 +10678,7 @@
    10678 10678
         ],
    
    10679 10679
         "rules": [
    
    10680 10680
           {
    
    10681
    -        "if": "((($ONLY_JOBS) && ($ONLY_JOBS =~ /.*\\bx86_64-freebsd14-validate(\\s|$).*/)) || (($ONLY_JOBS == null) && ((($CI_MERGE_REQUEST_LABELS =~ /.*full-ci.*/) || ($CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/) || ($CI_COMMIT_BRANCH == \"master\") || ($CI_COMMIT_BRANCH =~ /ghc-[0-9]+\\.[0-9]+/)) || ($CI_MERGE_REQUEST_LABELS =~ /.*FreeBSD.*/)))) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)",
    
    10681
    +        "if": "((($ONLY_JOBS) && ($ONLY_JOBS =~ /.*\\bx86_64-freebsd14-validate(\\s|$).*/)) || (($ONLY_JOBS == null) && ((($CI_MERGE_REQUEST_LABELS =~ /.*full-ci.*/) || ($CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/) || ($CI_COMMIT_BRANCH == \"master\") || ($CI_COMMIT_BRANCH =~ /^ghc-[0-9]+\\.[0-9]+$/)) || ($CI_MERGE_REQUEST_LABELS =~ /.*FreeBSD.*/)))) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)",
    
    10682 10682
             "when": "on_success"
    
    10683 10683
           }
    
    10684 10684
         ],
    
    ... ... @@ -10742,7 +10742,7 @@
    10742 10742
         ],
    
    10743 10743
         "rules": [
    
    10744 10744
           {
    
    10745
    -        "if": "((($ONLY_JOBS) && ($ONLY_JOBS =~ /.*\\bx86_64-freebsd14-validate(\\s|$).*/)) || (($ONLY_JOBS == null) && ((($CI_MERGE_REQUEST_LABELS =~ /.*full-ci.*/) || ($CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/) || ($CI_COMMIT_BRANCH == \"master\") || ($CI_COMMIT_BRANCH =~ /ghc-[0-9]+\\.[0-9]+/)) || ($CI_MERGE_REQUEST_LABELS =~ /.*FreeBSD.*/)))) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)",
    
    10745
    +        "if": "((($ONLY_JOBS) && ($ONLY_JOBS =~ /.*\\bx86_64-freebsd14-validate(\\s|$).*/)) || (($ONLY_JOBS == null) && ((($CI_MERGE_REQUEST_LABELS =~ /.*full-ci.*/) || ($CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/) || ($CI_COMMIT_BRANCH == \"master\") || ($CI_COMMIT_BRANCH =~ /^ghc-[0-9]+\\.[0-9]+$/)) || ($CI_MERGE_REQUEST_LABELS =~ /.*FreeBSD.*/)))) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)",
    
    10746 10746
             "when": "on_success"
    
    10747 10747
           }
    
    10748 10748
         ],
    
    ... ... @@ -10932,7 +10932,7 @@
    10932 10932
         ],
    
    10933 10933
         "rules": [
    
    10934 10934
           {
    
    10935
    -        "if": "((($ONLY_JOBS) && ($ONLY_JOBS =~ /.*\\bx86_64-linux-alpine3_12-validate\\+fully_static(\\s|$).*/)) || (($ONLY_JOBS == null) && ((($CI_MERGE_REQUEST_LABELS =~ /.*full-ci.*/) || ($CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/) || ($CI_COMMIT_BRANCH == \"master\") || ($CI_COMMIT_BRANCH =~ /ghc-[0-9]+\\.[0-9]+/))))) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)",
    
    10935
    +        "if": "((($ONLY_JOBS) && ($ONLY_JOBS =~ /.*\\bx86_64-linux-alpine3_12-validate\\+fully_static(\\s|$).*/)) || (($ONLY_JOBS == null) && ((($CI_MERGE_REQUEST_LABELS =~ /.*full-ci.*/) || ($CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/) || ($CI_COMMIT_BRANCH == \"master\") || ($CI_COMMIT_BRANCH =~ /^ghc-[0-9]+\\.[0-9]+$/))))) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)",
    
    10936 10936
             "when": "on_success"
    
    10937 10937
           }
    
    10938 10938
         ],
    
    ... ... @@ -10994,7 +10994,7 @@
    10994 10994
         ],
    
    10995 10995
         "rules": [
    
    10996 10996
           {
    
    10997
    -        "if": "((($ONLY_JOBS) && ($ONLY_JOBS =~ /.*\\bx86_64-linux-alpine3_12-validate\\+fully_static(\\s|$).*/)) || (($ONLY_JOBS == null) && ((($CI_MERGE_REQUEST_LABELS =~ /.*full-ci.*/) || ($CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/) || ($CI_COMMIT_BRANCH == \"master\") || ($CI_COMMIT_BRANCH =~ /ghc-[0-9]+\\.[0-9]+/))))) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)",
    
    10997
    +        "if": "((($ONLY_JOBS) && ($ONLY_JOBS =~ /.*\\bx86_64-linux-alpine3_12-validate\\+fully_static(\\s|$).*/)) || (($ONLY_JOBS == null) && ((($CI_MERGE_REQUEST_LABELS =~ /.*full-ci.*/) || ($CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/) || ($CI_COMMIT_BRANCH == \"master\") || ($CI_COMMIT_BRANCH =~ /^ghc-[0-9]+\\.[0-9]+$/))))) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)",
    
    10998 10998
             "when": "on_success"
    
    10999 10999
           }
    
    11000 11000
         ],
    
    ... ... @@ -11182,7 +11182,7 @@
    11182 11182
         ],
    
    11183 11183
         "rules": [
    
    11184 11184
           {
    
    11185
    -        "if": "((($ONLY_JOBS) && ($ONLY_JOBS =~ /.*\\bx86_64-linux-alpine3_23-wasm-cross_wasm32-wasi-release\\+host_fully_static\\+text_simdutf(\\s|$).*/)) || (($ONLY_JOBS == null) && ((($CI_MERGE_REQUEST_LABELS =~ /.*full-ci.*/) || ($CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/) || ($CI_COMMIT_BRANCH == \"master\") || ($CI_COMMIT_BRANCH =~ /ghc-[0-9]+\\.[0-9]+/)) || ($CI_MERGE_REQUEST_LABELS =~ /.*wasm.*/)))) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)",
    
    11185
    +        "if": "((($ONLY_JOBS) && ($ONLY_JOBS =~ /.*\\bx86_64-linux-alpine3_23-wasm-cross_wasm32-wasi-release\\+host_fully_static\\+text_simdutf(\\s|$).*/)) || (($ONLY_JOBS == null) && ((($CI_MERGE_REQUEST_LABELS =~ /.*full-ci.*/) || ($CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/) || ($CI_COMMIT_BRANCH == \"master\") || ($CI_COMMIT_BRANCH =~ /^ghc-[0-9]+\\.[0-9]+$/)) || ($CI_MERGE_REQUEST_LABELS =~ /.*wasm.*/)))) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)",
    
    11186 11186
             "when": "on_success"
    
    11187 11187
           }
    
    11188 11188
         ],
    
    ... ... @@ -11246,7 +11246,7 @@
    11246 11246
         ],
    
    11247 11247
         "rules": [
    
    11248 11248
           {
    
    11249
    -        "if": "((($ONLY_JOBS) && ($ONLY_JOBS =~ /.*\\bx86_64-linux-alpine3_23-wasm-cross_wasm32-wasi-release\\+host_fully_static\\+text_simdutf(\\s|$).*/)) || (($ONLY_JOBS == null) && ((($CI_MERGE_REQUEST_LABELS =~ /.*full-ci.*/) || ($CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/) || ($CI_COMMIT_BRANCH == \"master\") || ($CI_COMMIT_BRANCH =~ /ghc-[0-9]+\\.[0-9]+/)) || ($CI_MERGE_REQUEST_LABELS =~ /.*wasm.*/)))) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)",
    
    11249
    +        "if": "((($ONLY_JOBS) && ($ONLY_JOBS =~ /.*\\bx86_64-linux-alpine3_23-wasm-cross_wasm32-wasi-release\\+host_fully_static\\+text_simdutf(\\s|$).*/)) || (($ONLY_JOBS == null) && ((($CI_MERGE_REQUEST_LABELS =~ /.*full-ci.*/) || ($CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/) || ($CI_COMMIT_BRANCH == \"master\") || ($CI_COMMIT_BRANCH =~ /^ghc-[0-9]+\\.[0-9]+$/)) || ($CI_MERGE_REQUEST_LABELS =~ /.*wasm.*/)))) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)",
    
    11250 11250
             "when": "on_success"
    
    11251 11251
           }
    
    11252 11252
         ],
    
    ... ... @@ -11312,7 +11312,7 @@
    11312 11312
         "rules": [
    
    11313 11313
           {
    
    11314 11314
             "allow_failure": true,
    
    11315
    -        "if": "((($ONLY_JOBS) && ($ONLY_JOBS =~ /.*\\bx86_64-linux-alpine3_23-wasm-int_native-cross_wasm32-wasi-release\\+host_fully_static\\+text_simdutf(\\s|$).*/)) || (($ONLY_JOBS == null) && ((($CI_MERGE_REQUEST_LABELS =~ /.*full-ci.*/) || ($CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/) || ($CI_COMMIT_BRANCH == \"master\") || ($CI_COMMIT_BRANCH =~ /ghc-[0-9]+\\.[0-9]+/)) || ($CI_MERGE_REQUEST_LABELS =~ /.*wasm.*/)))) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)",
    
    11315
    +        "if": "((($ONLY_JOBS) && ($ONLY_JOBS =~ /.*\\bx86_64-linux-alpine3_23-wasm-int_native-cross_wasm32-wasi-release\\+host_fully_static\\+text_simdutf(\\s|$).*/)) || (($ONLY_JOBS == null) && ((($CI_MERGE_REQUEST_LABELS =~ /.*full-ci.*/) || ($CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/) || ($CI_COMMIT_BRANCH == \"master\") || ($CI_COMMIT_BRANCH =~ /^ghc-[0-9]+\\.[0-9]+$/)) || ($CI_MERGE_REQUEST_LABELS =~ /.*wasm.*/)))) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)",
    
    11316 11316
             "when": "manual"
    
    11317 11317
           }
    
    11318 11318
         ],
    
    ... ... @@ -11377,7 +11377,7 @@
    11377 11377
         "rules": [
    
    11378 11378
           {
    
    11379 11379
             "allow_failure": true,
    
    11380
    -        "if": "((($ONLY_JOBS) && ($ONLY_JOBS =~ /.*\\bx86_64-linux-alpine3_23-wasm-int_native-cross_wasm32-wasi-release\\+host_fully_static\\+text_simdutf(\\s|$).*/)) || (($ONLY_JOBS == null) && ((($CI_MERGE_REQUEST_LABELS =~ /.*full-ci.*/) || ($CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/) || ($CI_COMMIT_BRANCH == \"master\") || ($CI_COMMIT_BRANCH =~ /ghc-[0-9]+\\.[0-9]+/)) || ($CI_MERGE_REQUEST_LABELS =~ /.*wasm.*/)))) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)",
    
    11380
    +        "if": "((($ONLY_JOBS) && ($ONLY_JOBS =~ /.*\\bx86_64-linux-alpine3_23-wasm-int_native-cross_wasm32-wasi-release\\+host_fully_static\\+text_simdutf(\\s|$).*/)) || (($ONLY_JOBS == null) && ((($CI_MERGE_REQUEST_LABELS =~ /.*full-ci.*/) || ($CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/) || ($CI_COMMIT_BRANCH == \"master\") || ($CI_COMMIT_BRANCH =~ /^ghc-[0-9]+\\.[0-9]+$/)) || ($CI_MERGE_REQUEST_LABELS =~ /.*wasm.*/)))) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)",
    
    11381 11381
             "when": "manual"
    
    11382 11382
           }
    
    11383 11383
         ],
    
    ... ... @@ -11443,7 +11443,7 @@
    11443 11443
         "rules": [
    
    11444 11444
           {
    
    11445 11445
             "allow_failure": true,
    
    11446
    -        "if": "((($ONLY_JOBS) && ($ONLY_JOBS =~ /.*\\bx86_64-linux-alpine3_23-wasm-unreg-cross_wasm32-wasi-release\\+host_fully_static\\+text_simdutf(\\s|$).*/)) || (($ONLY_JOBS == null) && ((($CI_MERGE_REQUEST_LABELS =~ /.*full-ci.*/) || ($CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/) || ($CI_COMMIT_BRANCH == \"master\") || ($CI_COMMIT_BRANCH =~ /ghc-[0-9]+\\.[0-9]+/)) || ($CI_MERGE_REQUEST_LABELS =~ /.*wasm.*/)))) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)",
    
    11446
    +        "if": "((($ONLY_JOBS) && ($ONLY_JOBS =~ /.*\\bx86_64-linux-alpine3_23-wasm-unreg-cross_wasm32-wasi-release\\+host_fully_static\\+text_simdutf(\\s|$).*/)) || (($ONLY_JOBS == null) && ((($CI_MERGE_REQUEST_LABELS =~ /.*full-ci.*/) || ($CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/) || ($CI_COMMIT_BRANCH == \"master\") || ($CI_COMMIT_BRANCH =~ /^ghc-[0-9]+\\.[0-9]+$/)) || ($CI_MERGE_REQUEST_LABELS =~ /.*wasm.*/)))) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)",
    
    11447 11447
             "when": "manual"
    
    11448 11448
           }
    
    11449 11449
         ],
    
    ... ... @@ -11508,7 +11508,7 @@
    11508 11508
         "rules": [
    
    11509 11509
           {
    
    11510 11510
             "allow_failure": true,
    
    11511
    -        "if": "((($ONLY_JOBS) && ($ONLY_JOBS =~ /.*\\bx86_64-linux-alpine3_23-wasm-unreg-cross_wasm32-wasi-release\\+host_fully_static\\+text_simdutf(\\s|$).*/)) || (($ONLY_JOBS == null) && ((($CI_MERGE_REQUEST_LABELS =~ /.*full-ci.*/) || ($CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/) || ($CI_COMMIT_BRANCH == \"master\") || ($CI_COMMIT_BRANCH =~ /ghc-[0-9]+\\.[0-9]+/)) || ($CI_MERGE_REQUEST_LABELS =~ /.*wasm.*/)))) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)",
    
    11511
    +        "if": "((($ONLY_JOBS) && ($ONLY_JOBS =~ /.*\\bx86_64-linux-alpine3_23-wasm-unreg-cross_wasm32-wasi-release\\+host_fully_static\\+text_simdutf(\\s|$).*/)) || (($ONLY_JOBS == null) && ((($CI_MERGE_REQUEST_LABELS =~ /.*full-ci.*/) || ($CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/) || ($CI_COMMIT_BRANCH == \"master\") || ($CI_COMMIT_BRANCH =~ /^ghc-[0-9]+\\.[0-9]+$/)) || ($CI_MERGE_REQUEST_LABELS =~ /.*wasm.*/)))) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)",
    
    11512 11512
             "when": "manual"
    
    11513 11513
           }
    
    11514 11514
         ],
    
    ... ... @@ -11573,7 +11573,7 @@
    11573 11573
         ],
    
    11574 11574
         "rules": [
    
    11575 11575
           {
    
    11576
    -        "if": "((($ONLY_JOBS) && ($ONLY_JOBS =~ /.*\\bx86_64-linux-deb11-emsdk-closure-int_native-cross_javascript-unknown-ghcjs-validate(\\s|$).*/)) || (($ONLY_JOBS == null) && ((($CI_MERGE_REQUEST_LABELS =~ /.*full-ci.*/) || ($CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/) || ($CI_COMMIT_BRANCH == \"master\") || ($CI_COMMIT_BRANCH =~ /ghc-[0-9]+\\.[0-9]+/)) || ($CI_MERGE_REQUEST_LABELS =~ /.*javascript.*/)))) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)",
    
    11576
    +        "if": "((($ONLY_JOBS) && ($ONLY_JOBS =~ /.*\\bx86_64-linux-deb11-emsdk-closure-int_native-cross_javascript-unknown-ghcjs-validate(\\s|$).*/)) || (($ONLY_JOBS == null) && ((($CI_MERGE_REQUEST_LABELS =~ /.*full-ci.*/) || ($CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/) || ($CI_COMMIT_BRANCH == \"master\") || ($CI_COMMIT_BRANCH =~ /^ghc-[0-9]+\\.[0-9]+$/)) || ($CI_MERGE_REQUEST_LABELS =~ /.*javascript.*/)))) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)",
    
    11577 11577
             "when": "on_success"
    
    11578 11578
           }
    
    11579 11579
         ],
    
    ... ... @@ -11637,7 +11637,7 @@
    11637 11637
         ],
    
    11638 11638
         "rules": [
    
    11639 11639
           {
    
    11640
    -        "if": "((($ONLY_JOBS) && ($ONLY_JOBS =~ /.*\\bx86_64-linux-deb11-emsdk-closure-int_native-cross_javascript-unknown-ghcjs-validate(\\s|$).*/)) || (($ONLY_JOBS == null) && ((($CI_MERGE_REQUEST_LABELS =~ /.*full-ci.*/) || ($CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/) || ($CI_COMMIT_BRANCH == \"master\") || ($CI_COMMIT_BRANCH =~ /ghc-[0-9]+\\.[0-9]+/)) || ($CI_MERGE_REQUEST_LABELS =~ /.*javascript.*/)))) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)",
    
    11640
    +        "if": "((($ONLY_JOBS) && ($ONLY_JOBS =~ /.*\\bx86_64-linux-deb11-emsdk-closure-int_native-cross_javascript-unknown-ghcjs-validate(\\s|$).*/)) || (($ONLY_JOBS == null) && ((($CI_MERGE_REQUEST_LABELS =~ /.*full-ci.*/) || ($CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/) || ($CI_COMMIT_BRANCH == \"master\") || ($CI_COMMIT_BRANCH =~ /^ghc-[0-9]+\\.[0-9]+$/)) || ($CI_MERGE_REQUEST_LABELS =~ /.*javascript.*/)))) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)",
    
    11641 11641
             "when": "on_success"
    
    11642 11642
           }
    
    11643 11643
         ],
    
    ... ... @@ -12071,7 +12071,7 @@
    12071 12071
         ],
    
    12072 12072
         "rules": [
    
    12073 12073
           {
    
    12074
    -        "if": "((($ONLY_JOBS) && ($ONLY_JOBS =~ /.*\\bx86_64-linux-deb13-cross_aarch64-linux-gnu-validate(\\s|$).*/)) || (($ONLY_JOBS == null) && ((($CI_MERGE_REQUEST_LABELS =~ /.*full-ci.*/) || ($CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/) || ($CI_COMMIT_BRANCH == \"master\") || ($CI_COMMIT_BRANCH =~ /ghc-[0-9]+\\.[0-9]+/))))) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)",
    
    12074
    +        "if": "((($ONLY_JOBS) && ($ONLY_JOBS =~ /.*\\bx86_64-linux-deb13-cross_aarch64-linux-gnu-validate(\\s|$).*/)) || (($ONLY_JOBS == null) && ((($CI_MERGE_REQUEST_LABELS =~ /.*full-ci.*/) || ($CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/) || ($CI_COMMIT_BRANCH == \"master\") || ($CI_COMMIT_BRANCH =~ /^ghc-[0-9]+\\.[0-9]+$/))))) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)",
    
    12075 12075
             "when": "on_success"
    
    12076 12076
           }
    
    12077 12077
         ],
    
    ... ... @@ -12137,7 +12137,7 @@
    12137 12137
         ],
    
    12138 12138
         "rules": [
    
    12139 12139
           {
    
    12140
    -        "if": "((($ONLY_JOBS) && ($ONLY_JOBS =~ /.*\\bx86_64-linux-deb13-int_native-validate(\\s|$).*/)) || (($ONLY_JOBS == null) && ((($CI_MERGE_REQUEST_LABELS =~ /.*full-ci.*/) || ($CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/) || ($CI_COMMIT_BRANCH == \"master\") || ($CI_COMMIT_BRANCH =~ /ghc-[0-9]+\\.[0-9]+/))))) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)",
    
    12140
    +        "if": "((($ONLY_JOBS) && ($ONLY_JOBS =~ /.*\\bx86_64-linux-deb13-int_native-validate(\\s|$).*/)) || (($ONLY_JOBS == null) && ((($CI_MERGE_REQUEST_LABELS =~ /.*full-ci.*/) || ($CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/) || ($CI_COMMIT_BRANCH == \"master\") || ($CI_COMMIT_BRANCH =~ /^ghc-[0-9]+\\.[0-9]+$/))))) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)",
    
    12141 12141
             "when": "on_success"
    
    12142 12142
           }
    
    12143 12143
         ],
    
    ... ... @@ -12198,7 +12198,7 @@
    12198 12198
         ],
    
    12199 12199
         "rules": [
    
    12200 12200
           {
    
    12201
    -        "if": "((($ONLY_JOBS) && ($ONLY_JOBS =~ /.*\\bx86_64-linux-deb13-int_native-validate(\\s|$).*/)) || (($ONLY_JOBS == null) && ((($CI_MERGE_REQUEST_LABELS =~ /.*full-ci.*/) || ($CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/) || ($CI_COMMIT_BRANCH == \"master\") || ($CI_COMMIT_BRANCH =~ /ghc-[0-9]+\\.[0-9]+/))))) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)",
    
    12201
    +        "if": "((($ONLY_JOBS) && ($ONLY_JOBS =~ /.*\\bx86_64-linux-deb13-int_native-validate(\\s|$).*/)) || (($ONLY_JOBS == null) && ((($CI_MERGE_REQUEST_LABELS =~ /.*full-ci.*/) || ($CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/) || ($CI_COMMIT_BRANCH == \"master\") || ($CI_COMMIT_BRANCH =~ /^ghc-[0-9]+\\.[0-9]+$/))))) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)",
    
    12202 12202
             "when": "on_success"
    
    12203 12203
           }
    
    12204 12204
         ],
    
    ... ... @@ -12261,7 +12261,7 @@
    12261 12261
         "rules": [
    
    12262 12262
           {
    
    12263 12263
             "allow_failure": true,
    
    12264
    -        "if": "((($ONLY_JOBS) && ($ONLY_JOBS =~ /.*\\bx86_64-linux-deb13-no_tntc-validate(\\s|$).*/)) || (($ONLY_JOBS == null) && ((($CI_MERGE_REQUEST_LABELS =~ /.*full-ci.*/) || ($CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/) || ($CI_COMMIT_BRANCH == \"master\") || ($CI_COMMIT_BRANCH =~ /ghc-[0-9]+\\.[0-9]+/))))) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)",
    
    12264
    +        "if": "((($ONLY_JOBS) && ($ONLY_JOBS =~ /.*\\bx86_64-linux-deb13-no_tntc-validate(\\s|$).*/)) || (($ONLY_JOBS == null) && ((($CI_MERGE_REQUEST_LABELS =~ /.*full-ci.*/) || ($CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/) || ($CI_COMMIT_BRANCH == \"master\") || ($CI_COMMIT_BRANCH =~ /^ghc-[0-9]+\\.[0-9]+$/))))) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)",
    
    12265 12265
             "when": "manual"
    
    12266 12266
           }
    
    12267 12267
         ],
    
    ... ... @@ -12323,7 +12323,7 @@
    12323 12323
         "rules": [
    
    12324 12324
           {
    
    12325 12325
             "allow_failure": true,
    
    12326
    -        "if": "((($ONLY_JOBS) && ($ONLY_JOBS =~ /.*\\bx86_64-linux-deb13-no_tntc-validate(\\s|$).*/)) || (($ONLY_JOBS == null) && ((($CI_MERGE_REQUEST_LABELS =~ /.*full-ci.*/) || ($CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/) || ($CI_COMMIT_BRANCH == \"master\") || ($CI_COMMIT_BRANCH =~ /ghc-[0-9]+\\.[0-9]+/))))) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)",
    
    12326
    +        "if": "((($ONLY_JOBS) && ($ONLY_JOBS =~ /.*\\bx86_64-linux-deb13-no_tntc-validate(\\s|$).*/)) || (($ONLY_JOBS == null) && ((($CI_MERGE_REQUEST_LABELS =~ /.*full-ci.*/) || ($CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/) || ($CI_COMMIT_BRANCH == \"master\") || ($CI_COMMIT_BRANCH =~ /^ghc-[0-9]+\\.[0-9]+$/))))) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)",
    
    12327 12327
             "when": "manual"
    
    12328 12328
           }
    
    12329 12329
         ],
    
    ... ... @@ -12694,7 +12694,7 @@
    12694 12694
         ],
    
    12695 12695
         "rules": [
    
    12696 12696
           {
    
    12697
    -        "if": "((($ONLY_JOBS) && ($ONLY_JOBS =~ /.*\\bx86_64-linux-deb13-riscv-cross_riscv64-linux-gnu-validate(\\s|$).*/)) || (($ONLY_JOBS == null) && ((($CI_MERGE_REQUEST_LABELS =~ /.*full-ci.*/) || ($CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/) || ($CI_COMMIT_BRANCH == \"master\") || ($CI_COMMIT_BRANCH =~ /ghc-[0-9]+\\.[0-9]+/)) || ($CI_MERGE_REQUEST_LABELS =~ /.*RISC-V.*/)))) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)",
    
    12697
    +        "if": "((($ONLY_JOBS) && ($ONLY_JOBS =~ /.*\\bx86_64-linux-deb13-riscv-cross_riscv64-linux-gnu-validate(\\s|$).*/)) || (($ONLY_JOBS == null) && ((($CI_MERGE_REQUEST_LABELS =~ /.*full-ci.*/) || ($CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/) || ($CI_COMMIT_BRANCH == \"master\") || ($CI_COMMIT_BRANCH =~ /^ghc-[0-9]+\\.[0-9]+$/)) || ($CI_MERGE_REQUEST_LABELS =~ /.*RISC-V.*/)))) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)",
    
    12698 12698
             "when": "on_success"
    
    12699 12699
           }
    
    12700 12700
         ],
    
    ... ... @@ -12761,7 +12761,7 @@
    12761 12761
         ],
    
    12762 12762
         "rules": [
    
    12763 12763
           {
    
    12764
    -        "if": "((($ONLY_JOBS) && ($ONLY_JOBS =~ /.*\\bx86_64-linux-deb13-unreg-validate(\\s|$).*/)) || (($ONLY_JOBS == null) && ((($CI_MERGE_REQUEST_LABELS =~ /.*full-ci.*/) || ($CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/) || ($CI_COMMIT_BRANCH == \"master\") || ($CI_COMMIT_BRANCH =~ /ghc-[0-9]+\\.[0-9]+/))))) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)",
    
    12764
    +        "if": "((($ONLY_JOBS) && ($ONLY_JOBS =~ /.*\\bx86_64-linux-deb13-unreg-validate(\\s|$).*/)) || (($ONLY_JOBS == null) && ((($CI_MERGE_REQUEST_LABELS =~ /.*full-ci.*/) || ($CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/) || ($CI_COMMIT_BRANCH == \"master\") || ($CI_COMMIT_BRANCH =~ /^ghc-[0-9]+\\.[0-9]+$/))))) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)",
    
    12765 12765
             "when": "on_success"
    
    12766 12766
           }
    
    12767 12767
         ],
    
    ... ... @@ -12822,7 +12822,7 @@
    12822 12822
         ],
    
    12823 12823
         "rules": [
    
    12824 12824
           {
    
    12825
    -        "if": "((($ONLY_JOBS) && ($ONLY_JOBS =~ /.*\\bx86_64-linux-deb13-unreg-validate(\\s|$).*/)) || (($ONLY_JOBS == null) && ((($CI_MERGE_REQUEST_LABELS =~ /.*full-ci.*/) || ($CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/) || ($CI_COMMIT_BRANCH == \"master\") || ($CI_COMMIT_BRANCH =~ /ghc-[0-9]+\\.[0-9]+/))))) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)",
    
    12825
    +        "if": "((($ONLY_JOBS) && ($ONLY_JOBS =~ /.*\\bx86_64-linux-deb13-unreg-validate(\\s|$).*/)) || (($ONLY_JOBS == null) && ((($CI_MERGE_REQUEST_LABELS =~ /.*full-ci.*/) || ($CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/) || ($CI_COMMIT_BRANCH == \"master\") || ($CI_COMMIT_BRANCH =~ /^ghc-[0-9]+\\.[0-9]+$/))))) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)",
    
    12826 12826
             "when": "on_success"
    
    12827 12827
           }
    
    12828 12828
         ],
    
    ... ... @@ -12884,7 +12884,7 @@
    12884 12884
         ],
    
    12885 12885
         "rules": [
    
    12886 12886
           {
    
    12887
    -        "if": "((($ONLY_JOBS) && ($ONLY_JOBS =~ /.*\\bx86_64-linux-deb13-validate(\\s|$).*/)) || (($ONLY_JOBS == null) && ((($CI_MERGE_REQUEST_LABELS =~ /.*full-ci.*/) || ($CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/) || ($CI_COMMIT_BRANCH == \"master\") || ($CI_COMMIT_BRANCH =~ /ghc-[0-9]+\\.[0-9]+/)) || ($CI_MERGE_REQUEST_LABELS =~ /.*test-primops.*/)))) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)",
    
    12887
    +        "if": "((($ONLY_JOBS) && ($ONLY_JOBS =~ /.*\\bx86_64-linux-deb13-validate(\\s|$).*/)) || (($ONLY_JOBS == null) && ((($CI_MERGE_REQUEST_LABELS =~ /.*full-ci.*/) || ($CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/) || ($CI_COMMIT_BRANCH == \"master\") || ($CI_COMMIT_BRANCH =~ /^ghc-[0-9]+\\.[0-9]+$/)) || ($CI_MERGE_REQUEST_LABELS =~ /.*test-primops.*/)))) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)",
    
    12888 12888
             "when": "on_success"
    
    12889 12889
           }
    
    12890 12890
         ],
    
    ... ... @@ -13194,7 +13194,7 @@
    13194 13194
         "rules": [
    
    13195 13195
           {
    
    13196 13196
             "allow_failure": true,
    
    13197
    -        "if": "((($ONLY_JOBS) && ($ONLY_JOBS =~ /.*\\bx86_64-linux-deb13-validate\\+thread_sanitizer_cmm(\\s|$).*/)) || (($ONLY_JOBS == null) && ((($CI_MERGE_REQUEST_LABELS =~ /.*full-ci.*/) || ($CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/) || ($CI_COMMIT_BRANCH == \"master\") || ($CI_COMMIT_BRANCH =~ /ghc-[0-9]+\\.[0-9]+/))))) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)",
    
    13197
    +        "if": "((($ONLY_JOBS) && ($ONLY_JOBS =~ /.*\\bx86_64-linux-deb13-validate\\+thread_sanitizer_cmm(\\s|$).*/)) || (($ONLY_JOBS == null) && ((($CI_MERGE_REQUEST_LABELS =~ /.*full-ci.*/) || ($CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/) || ($CI_COMMIT_BRANCH == \"master\") || ($CI_COMMIT_BRANCH =~ /^ghc-[0-9]+\\.[0-9]+$/))))) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)",
    
    13198 13198
             "when": "manual"
    
    13199 13199
           }
    
    13200 13200
         ],
    
    ... ... @@ -13258,7 +13258,7 @@
    13258 13258
         "rules": [
    
    13259 13259
           {
    
    13260 13260
             "allow_failure": true,
    
    13261
    -        "if": "((($ONLY_JOBS) && ($ONLY_JOBS =~ /.*\\bx86_64-linux-deb13-validate\\+thread_sanitizer_cmm(\\s|$).*/)) || (($ONLY_JOBS == null) && ((($CI_MERGE_REQUEST_LABELS =~ /.*full-ci.*/) || ($CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/) || ($CI_COMMIT_BRANCH == \"master\") || ($CI_COMMIT_BRANCH =~ /ghc-[0-9]+\\.[0-9]+/))))) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)",
    
    13261
    +        "if": "((($ONLY_JOBS) && ($ONLY_JOBS =~ /.*\\bx86_64-linux-deb13-validate\\+thread_sanitizer_cmm(\\s|$).*/)) || (($ONLY_JOBS == null) && ((($CI_MERGE_REQUEST_LABELS =~ /.*full-ci.*/) || ($CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/) || ($CI_COMMIT_BRANCH == \"master\") || ($CI_COMMIT_BRANCH =~ /^ghc-[0-9]+\\.[0-9]+$/))))) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)",
    
    13262 13262
             "when": "manual"
    
    13263 13263
           }
    
    13264 13264
         ],
    
    ... ... @@ -13320,7 +13320,7 @@
    13320 13320
         ],
    
    13321 13321
         "rules": [
    
    13322 13322
           {
    
    13323
    -        "if": "((($ONLY_JOBS) && ($ONLY_JOBS =~ /.*\\bx86_64-linux-deb13-validate(\\s|$).*/)) || (($ONLY_JOBS == null) && ((($CI_MERGE_REQUEST_LABELS =~ /.*full-ci.*/) || ($CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/) || ($CI_COMMIT_BRANCH == \"master\") || ($CI_COMMIT_BRANCH =~ /ghc-[0-9]+\\.[0-9]+/)) || ($CI_MERGE_REQUEST_LABELS =~ /.*test-primops.*/)))) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)",
    
    13323
    +        "if": "((($ONLY_JOBS) && ($ONLY_JOBS =~ /.*\\bx86_64-linux-deb13-validate(\\s|$).*/)) || (($ONLY_JOBS == null) && ((($CI_MERGE_REQUEST_LABELS =~ /.*full-ci.*/) || ($CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/) || ($CI_COMMIT_BRANCH == \"master\") || ($CI_COMMIT_BRANCH =~ /^ghc-[0-9]+\\.[0-9]+$/)) || ($CI_MERGE_REQUEST_LABELS =~ /.*test-primops.*/)))) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)",
    
    13324 13324
             "when": "on_success"
    
    13325 13325
           }
    
    13326 13326
         ],
    
    ... ... @@ -13879,7 +13879,7 @@
    13879 13879
         ],
    
    13880 13880
         "rules": [
    
    13881 13881
           {
    
    13882
    -        "if": "((($ONLY_JOBS) && ($ONLY_JOBS =~ /.*\\bx86_64-linux-fedora43-validate\\+debug_info\\+ubsan(\\s|$).*/)) || (($ONLY_JOBS == null) && ((($CI_MERGE_REQUEST_LABELS =~ /.*full-ci.*/) || ($CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/) || ($CI_COMMIT_BRANCH == \"master\") || ($CI_COMMIT_BRANCH =~ /ghc-[0-9]+\\.[0-9]+/))))) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)",
    
    13882
    +        "if": "((($ONLY_JOBS) && ($ONLY_JOBS =~ /.*\\bx86_64-linux-fedora43-validate\\+debug_info\\+ubsan(\\s|$).*/)) || (($ONLY_JOBS == null) && ((($CI_MERGE_REQUEST_LABELS =~ /.*full-ci.*/) || ($CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/) || ($CI_COMMIT_BRANCH == \"master\") || ($CI_COMMIT_BRANCH =~ /^ghc-[0-9]+\\.[0-9]+$/))))) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)",
    
    13883 13883
             "when": "on_success"
    
    13884 13884
           }
    
    13885 13885
         ],
    
    ... ... @@ -13942,7 +13942,7 @@
    13942 13942
         ],
    
    13943 13943
         "rules": [
    
    13944 13944
           {
    
    13945
    -        "if": "((($ONLY_JOBS) && ($ONLY_JOBS =~ /.*\\bx86_64-linux-fedora43-validate\\+debug_info\\+ubsan(\\s|$).*/)) || (($ONLY_JOBS == null) && ((($CI_MERGE_REQUEST_LABELS =~ /.*full-ci.*/) || ($CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/) || ($CI_COMMIT_BRANCH == \"master\") || ($CI_COMMIT_BRANCH =~ /ghc-[0-9]+\\.[0-9]+/))))) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)",
    
    13945
    +        "if": "((($ONLY_JOBS) && ($ONLY_JOBS =~ /.*\\bx86_64-linux-fedora43-validate\\+debug_info\\+ubsan(\\s|$).*/)) || (($ONLY_JOBS == null) && ((($CI_MERGE_REQUEST_LABELS =~ /.*full-ci.*/) || ($CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/) || ($CI_COMMIT_BRANCH == \"master\") || ($CI_COMMIT_BRANCH =~ /^ghc-[0-9]+\\.[0-9]+$/))))) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)",
    
    13946 13946
             "when": "on_success"
    
    13947 13947
           }
    
    13948 13948
         ],
    
    ... ... @@ -14372,7 +14372,7 @@
    14372 14372
         ],
    
    14373 14373
         "rules": [
    
    14374 14374
           {
    
    14375
    -        "if": "((($ONLY_JOBS) && ($ONLY_JOBS =~ /.*\\bx86_64-linux-ubuntu24_04-loongarch-cross_loongarch64-linux-gnu-validate(\\s|$).*/)) || (($ONLY_JOBS == null) && ((($CI_MERGE_REQUEST_LABELS =~ /.*full-ci.*/) || ($CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/) || ($CI_COMMIT_BRANCH == \"master\") || ($CI_COMMIT_BRANCH =~ /ghc-[0-9]+\\.[0-9]+/)) || ($CI_MERGE_REQUEST_LABELS =~ /.*loongarch.*/)))) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)",
    
    14375
    +        "if": "((($ONLY_JOBS) && ($ONLY_JOBS =~ /.*\\bx86_64-linux-ubuntu24_04-loongarch-cross_loongarch64-linux-gnu-validate(\\s|$).*/)) || (($ONLY_JOBS == null) && ((($CI_MERGE_REQUEST_LABELS =~ /.*full-ci.*/) || ($CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/) || ($CI_COMMIT_BRANCH == \"master\") || ($CI_COMMIT_BRANCH =~ /^ghc-[0-9]+\\.[0-9]+$/)) || ($CI_MERGE_REQUEST_LABELS =~ /.*loongarch.*/)))) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)",
    
    14376 14376
             "when": "on_success"
    
    14377 14377
           }
    
    14378 14378
         ],
    

  • changelog.d/T27212
    1
    +section: compiler
    
    2
    +synopsis: Tiny change in -drule-check output
    
    3
    +issues: #27212
    
    4
    +mrs: !15954
    
    5
    +description: {
    
    6
    +  The formatting of the heading for the output of ``-drule-check``
    
    7
    +  has changed slightly.
    
    8
    +}

  • compiler/GHC/Core/Coercion.hs
    ... ... @@ -74,7 +74,7 @@ module GHC.Core.Coercion (
    74 74
             isReflCoVar_maybe, assertGoodForAllCo,
    
    75 75
     
    
    76 76
     
    
    77
    -        coToMCo, kindCoToMKindCo,
    
    77
    +        coToMCo, kindCoToMKindCo, mCoToCo,
    
    78 78
             mkTransMCo, mkTransMCoL, mkTransMCoR, mkCastTyMCo, mkSymMCo,
    
    79 79
             mkFunResMCo, mkPiMCos,
    
    80 80
             isReflMCo, checkReflexiveMCo,
    

  • compiler/GHC/Core/Opt/Arity.hs
    ... ... @@ -886,8 +886,14 @@ findRhsArity :: ArityOpts -> RecFlag -> Id -> CoreExpr
    886 886
     -- This implements the fixpoint loop for arity analysis
    
    887 887
     -- See Note [Arity analysis]
    
    888 888
     --
    
    889
    --- The Bool is True if the returned arity is greater than (exprArity rhs)
    
    890
    ---     so the caller should do eta-expansion
    
    889
    +-- The Bool is True if
    
    890
    +--            the returned arity is greater than (exprArity rhs)
    
    891
    +-- so the caller should do eta-expansion
    
    892
    +-- NB: `exprArity`, not `manifestArity`:
    
    893
    +--     a PAP such as (\x. f x), where f has arity 3, has exprArity 3,
    
    894
    +--     so we do not eta-expand it to (\x y z. f x y z)
    
    895
    +--     See Note [Do not eta-expand PAPs] in GHC.Core.Opt.Simplify.Utils
    
    896
    +--
    
    891 897
     -- That Bool is never True for join points, which are never eta-expanded
    
    892 898
     --
    
    893 899
     -- Returns an SafeArityType that is guaranteed trimmed to typeArity of 'bndr'
    
    ... ... @@ -903,10 +909,11 @@ findRhsArity opts is_rec bndr rhs
    903 909
     
    
    904 910
       | otherwise
    
    905 911
       = (arity_increased, non_join_arity_type)
    
    906
    -    -- arity_increased: eta-expand if we'll get more lambdas
    
    907
    -    -- to the top of the RHS
    
    912
    +    -- arity_increased: eta-expand if the analysis finds a greater arity
    
    913
    +    -- than exprArity, which already takes account of PAPs
    
    908 914
       where
    
    909
    -    old_arity = exprArity rhs
    
    915
    +    old_arity = exprArity rhs   -- See Note [Do not eta-expand PAPs]
    
    916
    +                                -- in GHC.Core.Opt.Simplify.Utils
    
    910 917
     
    
    911 918
         init_env :: ArityEnv
    
    912 919
         init_env = findRhsArityEnv opts (isJoinId bndr)
    
    ... ... @@ -2388,6 +2395,7 @@ mkEtaForAllMCo (Bndr tcv vis) ty mco
    2388 2395
         -- and is SymCo'd in `etaInfoAbs`.  Hence the orientation of the visibility
    
    2389 2396
         -- flags.  A bit of a brain-strain (#27557).
    
    2390 2397
     
    
    2398
    +
    
    2391 2399
     {-
    
    2392 2400
     ************************************************************************
    
    2393 2401
     *                                                                      *
    
    ... ... @@ -2452,16 +2460,20 @@ perform eta reduction on an expression with n leading lambdas `\xs. e xs`
    2452 2460
     (checked in 'is_eta_reduction_sound' in 'tryEtaReduce', which focuses on the
    
    2453 2461
     case where `e` is trivial):
    
    2454 2462
     
    
    2455
    -(A) It is sound to eta-reduce n arguments as long as n does not exceed the
    
    2456
    -    `exprArity` of `e`. (Needs Arity analysis.)
    
    2457
    -    This criterion exploits information about how `e` is *defined*.
    
    2463
    +(EtaA) It is sound to eta-reduce n arguments as long as n does not exceed the
    
    2464
    +    `exprArity` of `e`. (Needs Arity analysis.) This criterion exploits information
    
    2465
    +    about how `e` is *defined*.  For example:
    
    2466
    +      f = \xy. g x y   ===>    f = g
    
    2467
    +    This eta-reduction is good only if `g` has arity at least 2, otherwise
    
    2468
    +    f's arity will decrease from 2 to 1.
    
    2469
    +    c.f. Note [Arity robustness] in GHC.Core.Opt.Simplify.Env.
    
    2458 2470
     
    
    2459
    -    Example: If `e = \x. bot` then we know it won't diverge until it is called
    
    2460
    -    with one argument. Hence it is safe to eta-reduce `\x. e x` to `e`.
    
    2471
    +    Another example: If `e = \x. bot` then we know it won't diverge until it
    
    2472
    +    is called with one argument. Hence it is safe to eta-reduce `\x. e x` to `e`.
    
    2461 2473
         By contrast, it would be *unsound* to eta-reduce 2 args, `\x y. e x y` to `e`:
    
    2462 2474
         `e 42` diverges when `(\x y. e x y) 42` does not.
    
    2463 2475
     
    
    2464
    -(S) It is sound to eta-reduce n arguments in an evaluation context in which all
    
    2476
    +(EtaS) It is sound to eta-reduce n arguments in an evaluation context in which all
    
    2465 2477
         calls happen with at least n arguments. (Needs Strictness analysis.)
    
    2466 2478
         NB: This treats evaluations like a call with 0 args.
    
    2467 2479
         NB: This criterion exploits information about how `e` is *used*.
    
    ... ... @@ -2483,35 +2495,31 @@ case where `e` is trivial):
    2483 2495
         But it is unsound to eta-reduce the arg in `g2 (\x y. e x y)` to `g2 e`
    
    2484 2496
         when `e = \x. if x then bot else id`, because the latter will diverge when
    
    2485 2497
         the former would not. Fortunately, the strictness analyser will report
    
    2486
    -    "Not always called with two arguments" for `g2` and we won't eta-expand.
    
    2498
    +    "Not always called with two arguments" for `g2` and we won't eta-reduce.
    
    2487 2499
     
    
    2488 2500
         See Note [Eta reduction based on evaluation context] for the implementation
    
    2489 2501
         details. This criterion is tested extensively in T21261.
    
    2490 2502
     
    
    2491
    -(R) Note [Eta reduction in recursive RHSs] tells us that we should not
    
    2503
    +(EtaR) Note [Eta reduction in recursive RHSs] tells us that we should not
    
    2492 2504
         eta-reduce `f` in its own RHS and describes our fix.
    
    2493 2505
         There we have `f = \x. f x` and we should not eta-reduce to `f=f`. Which
    
    2494 2506
         might change a terminating program (think @f `seq` e@) to a non-terminating
    
    2495 2507
         one.
    
    2496 2508
     
    
    2497
    -(E) (See fun_arity in tryEtaReduce.) As a perhaps special case on the
    
    2498
    -    boundary of (A) and (S), when we know that a fun binder `f` is in
    
    2499
    -    WHNF, we simply assume it has arity 1 and apply (A).  Example:
    
    2509
    +(EtaE) (See fun_arity in tryEtaReduce.) As a perhaps special case on the
    
    2510
    +    boundary of (EtaA) and (EtaS), when we know that a fun binder `f` is in
    
    2511
    +    WHNF, we simply assume it has arity 1 and apply (EtaA).  Example:
    
    2500 2512
            g f = f `seq` \x. f x
    
    2501 2513
         Here it's sound eta-reduce `\x. f x` to `f`, because `f` can't be bottom
    
    2502 2514
         after the `seq`. This turned up in #7542.
    
    2503 2515
     
    
    2504
    - T. If the binders are all type arguments, it's always safe to eta-reduce,
    
    2505
    -    regardless of the arity of f.
    
    2506
    -       /\a b. f @a @b  --> f
    
    2507
    -
    
    2508
    -2. Type and dictionary abstraction. Regardless of whether 'f' is a value, it
    
    2516
    +(EtaT) Type and dictionary abstraction. Regardless of whether 'f' is a value, it
    
    2509 2517
        is always sound to reduce /type lambdas/, thus:
    
    2510
    -        (/\a -> f a)  -->   f
    
    2518
    +        (/\a -> f @a)  -->   f
    
    2511 2519
        Moreover, we always want to, because it makes RULEs apply more often:
    
    2512
    -      This RULE:    `forall g. foldr (build (/\a -> g a))`
    
    2520
    +      This RULE:    `forall g. foldr (build (/\a -> g @a))`
    
    2513 2521
           should match  `foldr (build (/\b -> ...something complex...))`
    
    2514
    -   and the simplest way to do so is eta-reduce `/\a -> g a` in the RULE to `g`.
    
    2522
    +   and the simplest way to do so is eta-reduce `/\a -> g @a` in the RULE to `g`.
    
    2515 2523
     
    
    2516 2524
        More debatably, we extend this to dictionary arguments too, because the type
    
    2517 2525
        checker can insert these eta-expanded versions, with both type and dictionary
    
    ... ... @@ -2523,18 +2531,25 @@ case where `e` is trivial):
    2523 2531
     And here are a few more technical criteria for when it is *not* sound to
    
    2524 2532
     eta-reduce that are specific to Core and GHC:
    
    2525 2533
     
    
    2526
    -(J) We may not undersaturate join points.
    
    2534
    +(EtaJ) We may not undersaturate join points.
    
    2527 2535
         See Note [Invariants on join points] in GHC.Core, and #20599.
    
    2528 2536
     
    
    2529
    -(B) We may not undersaturate functions with no binding.
    
    2537
    +(EtaB) We may not undersaturate functions with no binding.
    
    2530 2538
         See Note [Eta expanding primops].
    
    2531 2539
     
    
    2532
    -(W) We may not undersaturate StrictWorkerIds.
    
    2540
    +(EtaW) We may not undersaturate StrictWorkerIds.
    
    2533 2541
         See Note [CBV Function Ids: overview] in GHC.Types.Id.Info.
    
    2534 2542
     
    
    2535
    -Here is a list of historic accidents surrounding unsound eta-reduction:
    
    2536 2543
     
    
    2537
    -* Consider
    
    2544
    +Here is a list of historic notes surrounding unsound eta-reduction:
    
    2545
    +
    
    2546
    +(EtaMult) We used to disable eta-reduction if performing it would change multiplicity.
    
    2547
    +  For example:
    
    2548
    +      (\x. K x) :: Int -> T    but    K :: Int %1 -> T
    
    2549
    +  But that (a) inhibits beneficial eta-reduction (b) costs extra work to check, and
    
    2550
    +  now we don't even try. See Note [Linting linearity] in GHC.Core.Lint, esp EXAMPLE 4
    
    2551
    +
    
    2552
    +(EtaBot) Consider
    
    2538 2553
             f = \x.f x
    
    2539 2554
             h y = case (case y of { True -> f `seq` True; False -> False }) of
    
    2540 2555
                     True -> ...; False -> ...
    
    ... ... @@ -2548,16 +2563,6 @@ Here is a list of historic accidents surrounding unsound eta-reduction:
    2548 2563
       Result: seg-fault because the boolean case actually gets a function value.
    
    2549 2564
       See #1947.
    
    2550 2565
     
    
    2551
    -* Never *reduce* arity. For example
    
    2552
    -      f = \xy. g x y
    
    2553
    -  Then if h has arity 1 we don't want to eta-reduce because then
    
    2554
    -  f's arity would decrease, and that is bad
    
    2555
    -  [SG in 2022: I don't understand this point. There is no `h`, perhaps that
    
    2556
    -   should have been `g`. Even then, this proposed eta-reduction is invalid by
    
    2557
    -   criterion (A), which might actually be the point this anecdote is trying to
    
    2558
    -   make. Perhaps the "no arity decrease" idea is also related to
    
    2559
    -   Note [Arity robustness]?]
    
    2560
    -
    
    2561 2566
     Note [Do not eta reduce PAPs]
    
    2562 2567
     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    2563 2568
     I considered eta-reducing if the result is a PAP:
    
    ... ... @@ -2598,11 +2603,14 @@ This should be eta-reduced to
    2598 2603
     
    
    2599 2604
     So we need to accumulate a coercion, pushing it inward (past
    
    2600 2605
     variable arguments only) thus:
    
    2601
    -   f (x |> co_arg) |> co  -->  (f |> (sym co_arg -> co)) x
    
    2602
    -   f (x:t)         |> co  -->  (f |> (t -> co)) x
    
    2603
    -   f @ a           |> co  -->  (f |> (forall a.co)) @ a
    
    2604
    -   f @ (g:t1~t2)   |> co  -->  (f |> (t1~t2 => co)) @ (g:t1~t2)
    
    2605
    -These are the equations for ok_arg.
    
    2606
    +(ECA1)   \x. f (x |> co_arg) |> co  -->  (f |> (sym co_arg -> co))
    
    2607
    +(ECA2)   \x. f (x:t)         |> co  -->  (f |> (t -> co))
    
    2608
    +(ECA3)   \x. f (x:t1~#t2)    |> co  -->  (f |> (t1~#t2 => co))
    
    2609
    +(ECA4)   \x. f @ a           |> co  -->  (f |> (forall a.co))
    
    2610
    +
    
    2611
    +(ECA1,2,4) are implemented by the `go` equations in `tryEtaReduce`.
    
    2612
    +However (ECA3) is not implemented -- it could be, perhaps by spotting
    
    2613
    +an argument that is (Coercion (CoVar x)), but it seems like a rare case.
    
    2606 2614
     
    
    2607 2615
     Note [Eta reduction with casted function]
    
    2608 2616
     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    ... ... @@ -2620,7 +2628,7 @@ eta-expansion may be turned off (by sm_eta_expand).
    2620 2628
     
    
    2621 2629
     Note [Eta reduction based on evaluation context]
    
    2622 2630
     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    2623
    -Note [Eta reduction soundness], criterion (S) allows us to eta-reduce
    
    2631
    +Note [Eta reduction soundness], criterion (EtaS) allows us to eta-reduce
    
    2624 2632
     `g (\x y. e x y)` to `g e` when we know that `g` always calls its parameter with
    
    2625 2633
     at least 2 arguments. So how do we read that off `g`'s demand signature?
    
    2626 2634
     
    
    ... ... @@ -2713,13 +2721,13 @@ tryEtaReduce :: UnVarSet -> [Var] -> CoreExpr -> SubDemand -> Maybe CoreExpr
    2713 2721
     -- and Note [Eta reduction makes sense] when that is the case.
    
    2714 2722
     -- and Note [Eta reduction based on evaluation context] for the `eval_sd` arg
    
    2715 2723
     tryEtaReduce rec_ids bndrs body eval_sd
    
    2716
    -  = go (reverse bndrs) body (mkRepReflCo (exprType body))
    
    2724
    +  = go (reverse bndrs) body MRefl
    
    2717 2725
       where
    
    2718
    -    incoming_arity = count isId bndrs -- See Note [Eta reduction makes sense], point (2)
    
    2726
    +    incoming_arity = count isId bndrs -- See (EtaA) in Note [Eta reduction soundness]
    
    2719 2727
     
    
    2720 2728
         go :: [Var]            -- Binders, innermost first, types [a3,a2,a1]
    
    2721 2729
            -> CoreExpr         -- Of type tr
    
    2722
    -       -> Coercion         -- Of type tr ~ ts
    
    2730
    +       -> MCoercion        -- Of type tr ~ ts
    
    2723 2731
            -> Maybe CoreExpr   -- Of type a1 -> a2 -> a3 -> ts
    
    2724 2732
         -- See Note [Eta reduction with casted arguments]
    
    2725 2733
         -- for why we have an accumulating coercion
    
    ... ... @@ -2729,19 +2737,37 @@ tryEtaReduce rec_ids bndrs body eval_sd
    2729 2737
     
    
    2730 2738
         -- See Note [Eta reduction with casted function]
    
    2731 2739
         go bs (Cast e co1) co2
    
    2732
    -      = go bs e (co1 `mkTransCo` co2)
    
    2740
    +      = go bs e (co1 `mkTransMCoR` co2)
    
    2733 2741
     
    
    2734 2742
         go bs (Tick t e) co
    
    2735 2743
           | tickishFloatable t
    
    2736 2744
           = fmap (Tick t) $ go bs e co
    
    2737 2745
           -- Float app ticks: \x -> Tick t (e x) ==> Tick t e
    
    2738 2746
     
    
    2739
    -    go (b : bs) (App fun arg) co
    
    2740
    -      | Just (co', ticks) <- ok_arg b arg co (exprType fun)
    
    2741
    -      = fmap (flip (foldr mkTick) ticks) $ go bs fun co'
    
    2742
    -            -- Float arg ticks: \x -> e (Tick t x) ==> Tick t e
    
    2747
    +    -- Implements (ECA4)
    
    2748
    +    go all_bs@(b : bs) all_e@(App fun (Type arg_ty)) mco
    
    2749
    +      | Just tv <- getTyVar_maybe arg_ty
    
    2750
    +      , b == tv
    
    2751
    +      , Just (bndr, body_ty) <- splitForAllForAllTyBinder_maybe (exprType fun)
    
    2752
    +      = go bs fun (mkEtaReduceForAllMCo bndr body_ty tv mco)
    
    2743 2753
     
    
    2744
    -    go remaining_bndrs fun co
    
    2754
    +      | otherwise
    
    2755
    +      = go_finish all_bs all_e mco
    
    2756
    +        -- Want to go to the finish case; see the call
    
    2757
    +        -- to (all isTyVar remaining_bndrs) there
    
    2758
    +
    
    2759
    +    -- Implements (ECA1,2)
    
    2760
    +    go (b : bs) (App fun val_arg) mco
    
    2761
    +      | Just (v, arg_mco, arg_ticks) <- getTrivialHead_maybe val_arg
    
    2762
    +      , b == v
    
    2763
    +      , Just co' <- mkEtaReduceFunCo (exprType fun) arg_mco mco
    
    2764
    +      = fmap (flip (foldr mkTick) arg_ticks) $
    
    2765
    +        go bs fun co'
    
    2766
    +        -- Float arg ticks: \x -> e (Tick t x) ==> Tick t e
    
    2767
    +
    
    2768
    +    go bs fun co = go_finish bs fun co
    
    2769
    +
    
    2770
    +    go_finish remaining_bndrs fun co
    
    2745 2771
           | all isTyVar remaining_bndrs
    
    2746 2772
                 -- If all the remaining_bnrs are tyvars, then the etad_exp
    
    2747 2773
                 --    will be trivial, which is what we want.
    
    ... ... @@ -2752,7 +2778,7 @@ tryEtaReduce rec_ids bndrs body eval_sd
    2752 2778
           , remaining_bndrs `ltLength` bndrs
    
    2753 2779
                 -- Only reply Just if /something/ has happened
    
    2754 2780
           , ok_fun fun
    
    2755
    -      , let used_vars     = exprFreeVars fun `unionVarSet` tyCoVarsOfCo co
    
    2781
    +      , let used_vars     = exprFreeVars fun `unionVarSet` tyCoVarsOfMCo co
    
    2756 2782
                 reduced_bndrs = mkVarSet (dropList remaining_bndrs bndrs)
    
    2757 2783
                 -- reduced_bndrs are the ones we are eta-reducing away
    
    2758 2784
           , used_vars `disjointVarSet` reduced_bndrs
    
    ... ... @@ -2761,10 +2787,10 @@ tryEtaReduce rec_ids bndrs body eval_sd
    2761 2787
               -- See Note [Eta reduction makes sense], intro and point (1)
    
    2762 2788
               -- NB: don't compute used_vars from exprFreeVars (mkCast fun co)
    
    2763 2789
               --     because the latter may be ill formed if the guard fails (#21801)
    
    2764
    -      = Just (mkLams (reverse remaining_bndrs) (mkCast fun co))
    
    2790
    +      = Just (mkLams (reverse remaining_bndrs) (mkCastMCo fun co))
    
    2765 2791
     
    
    2766
    -    go _remaining_bndrs _fun  _  = -- pprTrace "tER fail" (ppr _fun $$ ppr _remaining_bndrs) $
    
    2767
    -                                   Nothing
    
    2792
    +      | otherwise
    
    2793
    +      = Nothing
    
    2768 2794
     
    
    2769 2795
         ---------------
    
    2770 2796
         -- See Note [Eta reduction makes sense], point (1)
    
    ... ... @@ -2777,18 +2803,18 @@ tryEtaReduce rec_ids bndrs body eval_sd
    2777 2803
         ---------------
    
    2778 2804
         -- See Note [Eta reduction soundness], this is THE place to check soundness!
    
    2779 2805
         is_eta_reduction_sound fun
    
    2780
    -      | fun `elemUnVarSet` rec_ids          -- Criterion (R)
    
    2806
    +      | fun `elemUnVarSet` rec_ids          -- Criterion (EtaR)
    
    2781 2807
           = False -- Don't eta-reduce in fun in its own recursive RHSs
    
    2782 2808
     
    
    2783
    -      | cantEtaReduceFun fun                -- Criteria (J), (W), (B)
    
    2809
    +      | cantEtaReduceFun fun                -- Criteria (EtaJ), (EtaW), (EtaB)
    
    2784 2810
           = False -- Function can't be eta reduced to arity 0
    
    2785 2811
                   -- without violating invariants of Core and GHC
    
    2786 2812
     
    
    2787 2813
           | otherwise
    
    2788 2814
           = -- Check that eta-reduction won't make the program stricter...
    
    2789
    -        fun_arity fun >= incoming_arity          -- Criterion (A) and (E)
    
    2790
    -        || all_calls_with_arity incoming_arity   -- Criterion (S)
    
    2791
    -        || all ok_lam bndrs                      -- Criterion (T)
    
    2815
    +        fun_arity fun >= incoming_arity          -- Criterion (EtaA) and (EtaE)
    
    2816
    +        || all_calls_with_arity incoming_arity   -- Criterion (EtaS)
    
    2817
    +        || all ok_lam bndrs                      -- Criterion (EtaT)
    
    2792 2818
     
    
    2793 2819
         all_calls_with_arity n = isStrict (fst $ peelManyCalls n eval_sd)
    
    2794 2820
            -- See Note [Eta reduction based on evaluation context]
    
    ... ... @@ -2797,57 +2823,76 @@ tryEtaReduce rec_ids bndrs body eval_sd
    2797 2823
         fun_arity fun
    
    2798 2824
            | arity > 0                           = arity
    
    2799 2825
            | isEvaldUnfolding (idUnfolding fun)  = 1
    
    2800
    -           -- See Note [Eta reduction soundness], criterion (E)
    
    2826
    +           -- See Note [Eta reduction soundness], criterion (EtaE)
    
    2801 2827
            | otherwise                           = 0
    
    2802 2828
            where
    
    2803 2829
              arity = idArity fun
    
    2804 2830
     
    
    2805 2831
         ---------------
    
    2806 2832
         ok_lam v = isTyVar v || isEvId v
    
    2807
    -    -- See Note [Eta reduction makes sense], point (2)
    
    2808
    -
    
    2809
    -    ---------------
    
    2810
    -    ok_arg :: Var              -- Of type bndr_t
    
    2811
    -           -> CoreExpr         -- Of type arg_t
    
    2812
    -           -> Coercion         -- Of kind (t1~t2)
    
    2813
    -           -> Type             -- Type (arg_t -> t1) of the function
    
    2814
    -                               --      to which the argument is supplied
    
    2815
    -           -> Maybe (Coercion  -- Of type (arg_t -> t1 ~  bndr_t -> t2)
    
    2816
    -                               --   (and similarly for tyvars, coercion args)
    
    2817
    -                    , [CoreTickish])
    
    2818
    -    -- See Note [Eta reduction with casted arguments]
    
    2819
    -    ok_arg bndr (Type arg_ty) co fun_ty
    
    2820
    -       | Just tv <- getTyVar_maybe arg_ty
    
    2821
    -       , bndr == tv  = case splitForAllForAllTyBinder_maybe fun_ty of
    
    2822
    -           Just (Bndr _ vis, _) -> Just (fco, [])
    
    2823
    -             where !fco = mkForAllCo tv vis coreTyLamForAllTyFlag MRefl co
    
    2824
    -                   -- The lambda we are eta-reducing always has visibility
    
    2825
    -                   -- 'coreTyLamForAllTyFlag' which may or may not match
    
    2826
    -                   -- the visibility on the inner function (#24014)
    
    2827
    -           Nothing -> pprPanic "tryEtaReduce: type arg to non-forall type"
    
    2828
    -                               (text "fun:" <+> ppr bndr
    
    2829
    -                                $$ text "arg:" <+> ppr arg_ty
    
    2830
    -                                $$ text "fun_ty:" <+> ppr fun_ty)
    
    2831
    -    ok_arg bndr (Var v) co fun_ty
    
    2832
    -       | bndr == v
    
    2833
    -       , let mult = idMult bndr
    
    2834
    -       , Just (_af, fun_mult, _, _) <- splitFunTy_maybe fun_ty
    
    2835
    -       , mult `eqType` fun_mult -- There is no change in multiplicity, otherwise we must abort
    
    2836
    -       = Just (mkFunResCo Representational bndr co, [])
    
    2837
    -    ok_arg bndr (Cast e co_arg) co fun_ty
    
    2838
    -       | (ticks, Var v) <- stripTicksTop tickishFloatable e
    
    2839
    -       , Just (_, fun_mult, _, _) <- splitFunTy_maybe fun_ty
    
    2840
    -       , bndr == v
    
    2841
    -       , fun_mult `eqType` idMult bndr
    
    2842
    -       = Just (mkFunCoNoFTF Representational (multToCo fun_mult) (mkSymCo co_arg) co, ticks)
    
    2843
    -       -- The simplifier combines multiple casts into one,
    
    2844
    -       -- so we can have a simple-minded pattern match here
    
    2845
    -    ok_arg bndr (Tick t arg) co fun_ty
    
    2846
    -       | tickishFloatable t, Just (co', ticks) <- ok_arg bndr arg co fun_ty
    
    2847
    -       = Just (co', t:ticks)
    
    2848
    -
    
    2849
    -    ok_arg _ _ _ _ = Nothing
    
    2833
    +    -- See Note [Eta reduction soundness], point (EtaT)
    
    2834
    +
    
    2835
    +
    
    2836
    +-----------------
    
    2837
    +getTrivialHead_maybe :: CoreExpr -> Maybe (Id, MCoercion, [CoreTickish])
    
    2838
    +-- (getTrivialHead_maybe e) returns (Just (fn, co,ts))
    
    2839
    +-- if `e` looks like (Tick ts (fn |> co)) and ts are floatable
    
    2840
    +-- So  co :: fn_ty ~ arg_ty
    
    2841
    +
    
    2842
    +getTrivialHead_maybe (Var v)
    
    2843
    +   = Just (v, MRefl, [])
    
    2844
    +
    
    2845
    +getTrivialHead_maybe (Cast e co_outer)
    
    2846
    +   = do { (v, mco_inner, ticks) <- getTrivialHead_maybe e
    
    2847
    +        ; return (v, mco_inner `mkTransMCoL` co_outer, ticks) }
    
    2848
    +
    
    2849
    +getTrivialHead_maybe (Tick t arg)
    
    2850
    +   | tickishFloatable t
    
    2851
    +   = do { (v, co, ticks) <- getTrivialHead_maybe arg
    
    2852
    +        ; return (v, co, t:ticks) }
    
    2853
    +
    
    2854
    +getTrivialHead_maybe _ = Nothing
    
    2855
    +
    
    2856
    +-----------------
    
    2857
    +mkEtaReduceFunCo :: Type -> MCoercion -> MCoercion -> Maybe MCoercion
    
    2858
    +mkEtaReduceFunCo _ MRefl MRefl
    
    2859
    +  = Just MRefl    -- Very common case
    
    2860
    +mkEtaReduceFunCo fun_ty arg_mco res_mco
    
    2861
    +  | Just (ftf, mult, arg_ty, res_ty) <- splitFunTy_maybe fun_ty
    
    2862
    +  --   fun_ty = arg_ty -> res_ty
    
    2863
    +  --   sym arg_mco : arg_ty ~ inner_arg_ty
    
    2864
    +  --       res_mco : res_ty ~ outer_res_ty
    
    2865
    +  , let arg_co  = mCoToCo Representational arg_ty arg_mco
    
    2866
    +        res_co  = mCoToCo Representational res_ty res_mco
    
    2867
    +        mult_co = multToCo mult
    
    2868
    +        ftf'    = chooseFunTyFlag (coercionLKind arg_co) (coercionRKind res_co)
    
    2869
    +  = Just (MCo (mkFunCo2 Representational ftf ftf' mult_co (mkSymCo arg_co) res_co))
    
    2870
    +              -- (arg_ty -> res_ty) ~ (inner_arg_ty -> outer_res_ty)
    
    2871
    +  | otherwise
    
    2872
    +  = Nothing
    
    2850 2873
     
    
    2874
    +-----------------
    
    2875
    +mkEtaReduceForAllMCo :: ForAllTyBinder -> Type -> TyVar -> MCoercion -> MCoercion
    
    2876
    +-- Very similar to mkEtaForAllMCo, but with
    
    2877
    +-- the visibilities the other way around.  Tiresome.
    
    2878
    +--   mkEtaReduceForAllMCo (forall a[vis]. body_ty) b (co :: ty1 ~ ty2)
    
    2879
    +--     (where `b` may be free in `ty1` and `ty2`)
    
    2880
    +--   = ForAllCo b[vis]~[spec]. (co :: ty1 ~ ty2)
    
    2881
    +-- where `coreTyLamForAllTyFlag` is  [spec]
    
    2882
    +mkEtaReduceForAllMCo (Bndr fun_tv vis) body_ty tv mco
    
    2883
    +  = case mco of
    
    2884
    +      MRefl  | isCoreTyLamForAllTyFlag vis
    
    2885
    +                -- The lambda we are eta-reducing always has visibility
    
    2886
    +                -- 'coreTyLamForAllTyFlag' which may or may not match the
    
    2887
    +                -- visibility on the inner function (#24014)
    
    2888
    +             -> MRefl
    
    2889
    +             | otherwise
    
    2890
    +             -> MCo $ mkForAllCo fun_tv vis coreTyLamForAllTyFlag MRefl refl_co
    
    2891
    +      MCo co -> MCo $ mkForAllCo tv     vis coreTyLamForAllTyFlag MRefl co
    
    2892
    +                -- Tricky: `fun_tv` scopes over `body_ty` and hence over `refl_co`
    
    2893
    +                --    but: `tv` scopes over `mco` and hence over `co`
    
    2894
    +  where
    
    2895
    +    refl_co = mkRepReflCo body_ty
    
    2851 2896
     
    
    2852 2897
     {- *********************************************************************
    
    2853 2898
     *                                                                      *
    

  • compiler/GHC/Core/Opt/OccurAnal.hs
    ... ... @@ -42,7 +42,6 @@ import GHC.Core.Utils ( exprIsTrivial, isDefaultAlt, isExpandableApp,
    42 42
     import GHC.Core.Opt.Arity   ( joinRhsArity, isOneShotBndr )
    
    43 43
     import GHC.Core.Coercion
    
    44 44
     import GHC.Core.Type
    
    45
    -import GHC.Core.TyCo.FVs    ( tyCoVarsOfMCo )
    
    46 45
     
    
    47 46
     import GHC.Data.Maybe( orElse )
    
    48 47
     import GHC.Data.Graph.Directed ( SCC(..), Node(..)
    
    ... ... @@ -2227,7 +2226,7 @@ lambda and casts, e.g.
    2227 2226
     
    
    2228 2227
     * Why do we take care to account for intervening casts? Answer:
    
    2229 2228
       currently we don't do eta-expansion and cast-swizzling in a stable
    
    2230
    -  unfolding (see Historical-note [Eta-expansion in stable unfoldings]).
    
    2229
    +  unfolding (see Note [Eta expansion in stable unfoldings and rules])
    
    2231 2230
       So we can get
    
    2232 2231
         f = \x. ((\y. ...x...y...) |> co)
    
    2233 2232
       Now, since the lambdas aren't together, the occurrence analyser will
    

  • compiler/GHC/Core/Opt/Pipeline.hs
    ... ... @@ -352,8 +352,25 @@ runMaybe :: Maybe a -> (a -> CoreToDo) -> CoreToDo
    352 352
     runMaybe (Just x) f = f x
    
    353 353
     runMaybe Nothing  _ = CoreDoNothing
    
    354 354
     
    
    355
    -{- Note [Inline in InitialPhase]
    
    356
    -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    355
    +{- Note [The InitialPhase of the Simplifier]
    
    356
    +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    357
    +The first run of the simplifier, historically called "gentle" simplification,
    
    358
    +has phase=InitialPhase, which does a number of things:
    
    359
    +
    
    360
    +* Usually sm_case_case is switched off in this phase; see
    
    361
    +  Note [Case-of-case and full laziness] and `initGentleSimplMode`
    
    362
    +
    
    363
    +* Inlining, however, is not switched off in InitialPhase.
    
    364
    +  See Note [Inline in InitialPhase]
    
    365
    +
    
    366
    +* Rules can run in InitialPhase
    
    367
    +  Note [RULEs enabled in InitialPhase]
    
    368
    +
    
    369
    +* Lint is a little aggressive about loop-breaker warnings in InitialPhase.
    
    370
    +  See `check_lbs` in `GHC.Core.Lint.perPassFlags`.
    
    371
    +
    
    372
    +Note [Inline in InitialPhase]
    
    373
    +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    357 374
     In GHC 8 and earlier we did not inline anything in the InitialPhase. But that is
    
    358 375
     confusing for users because when they say INLINE they expect the function to inline
    
    359 376
     right away.
    

  • compiler/GHC/Core/Opt/Simplify/Env.hs
    ... ... @@ -355,12 +355,18 @@ This simplifier phase is stored in the sm_phase field of SimplMode, usin
    355 355
     the 'SimplPhase' constructor. This allows us to determine which rules/inlinings
    
    356 356
     are active.
    
    357 357
     
    
    358
    -When we invoke the simplifier on the RHS of a rule, such as 'rhs' above, instead
    
    359
    -of setting the simplifier mode to a single phase, we use a phase range
    
    360
    -corresponding to the range of phases in which the rule is active, with the
    
    361
    -'SimplPhaseRange' constructor. This allows us to check whether other rules or
    
    362
    -inlinings are active throughout the whole activation of the rule.
    
    363
    -See Note [What is active in the RHS of a RULE or unfolding?] in GHC.Core.Opt.Simplify.Utils.
    
    358
    +Wrinkles
    
    359
    +
    
    360
    +(SP1) InitialPhase: see Note [The InitialPhase of the Simplifier]
    
    361
    +    in GHC.Core.Opt.Pipeline.
    
    362
    +
    
    363
    +(SP2) Phase ranges.  When we invoke the simplifier on the RHS of a rule, such as
    
    364
    +    `rhs` above, instead of setting the simplifier mode to a single phase, we use a
    
    365
    +    phase /range/ corresponding to the range of phases in which the rule is active,
    
    366
    +    with the 'SimplPhaseRange' constructor. This allows us to check whether other
    
    367
    +    rules or inlinings are active throughout the whole activation of the rule.  See
    
    368
    +    Note [What is active in the RHS of a RULE or unfolding?]  in
    
    369
    +    GHC.Core.Opt.Simplify.Utils.
    
    364 370
     -}
    
    365 371
     
    
    366 372
     instance Outputable SimplMode where
    
    ... ... @@ -1234,6 +1240,8 @@ out_id so that its arity is visible in its RHS. Examples:
    1234 1240
         Example: `f = \x. f x`. See Note [Eta reduction in recursive RHSs] for how
    
    1235 1241
         we prevent that.
    
    1236 1242
     
    
    1243
    +c.f. (EtaA) in Note [Eta reduction soundness] in GHC.Core.Opt.Arity.
    
    1244
    +
    
    1237 1245
     Note [Robust OccInfo]
    
    1238 1246
     ~~~~~~~~~~~~~~~~~~~~~
    
    1239 1247
     It's important that we *do* retain the loop-breaker OccInfo, because
    

  • compiler/GHC/Core/Opt/Simplify/Inline.hs
    ... ... @@ -126,11 +126,6 @@ activeUnfolding mode id
    126 126
       | otherwise
    
    127 127
       =  isActive (sm_phase mode) (idInlineActivation id)
    
    128 128
       && sm_inline mode
    
    129
    -      -- `or` isStableUnfolding (realIdUnfolding id)
    
    130
    -      -- Inline things when
    
    131
    -      --  (a) they are active
    
    132
    -      --  (b) sm_inline says so, except that for stable unfoldings
    
    133
    -      --                         (ie pragmas) we inline anyway
    
    134 129
     
    
    135 130
     -- | Report the inlining of an identifier's RHS to the user, if requested.
    
    136 131
     traceInline :: Logger -> UnfoldingOpts -> Id -> String -> SDoc -> a -> a
    

  • compiler/GHC/Core/Opt/Simplify/Iteration.hs
    ... ... @@ -3143,7 +3143,7 @@ There have been various earlier versions of this patch:
    3143 3143
         case_bndr_evald_next _               = False
    
    3144 3144
     
    
    3145 3145
       This patch was part of fixing #7542. See also
    
    3146
    -  Note [Eta reduction soundness], criterion (E) in GHC.Core.Utils.)
    
    3146
    +  Note [Eta reduction soundness], criterion (EtaE) in GHC.Core.Opt.Arity.)
    
    3147 3147
     
    
    3148 3148
     
    
    3149 3149
     Further notes about case elimination
    
    ... ... @@ -4959,7 +4959,7 @@ eta-expand the stable unfolding to arity N too. Simple and consistent.
    4959 4959
     
    
    4960 4960
     Wrinkles
    
    4961 4961
     
    
    4962
    -* See Historical-note [Eta-expansion in stable unfoldings] in
    
    4962
    +* See Note [Eta expansion in stable unfoldings and rules]
    
    4963 4963
       GHC.Core.Opt.Simplify.Utils
    
    4964 4964
     
    
    4965 4965
     * Don't eta-expand a trivial expr, else each pass will eta-reduce it,
    

  • compiler/GHC/Core/Opt/Simplify/Utils.hs
    ... ... @@ -1319,43 +1319,6 @@ But this old note is no longer relevant because the specialiser has
    1319 1319
     improved: see Note [Account for casts in binding] in
    
    1320 1320
     GHC.Core.Opt.Specialise.  So we seem to have a free choice.
    
    1321 1321
     
    
    1322
    -Note [Inlining in gentle mode]
    
    1323
    -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    1324
    -Something is inlined if
    
    1325
    -   (i)   the sm_inline flag is on, AND
    
    1326
    -   (ii)  the thing has an INLINE pragma, AND
    
    1327
    -   (iii) the thing is inlinable in the earliest phase.
    
    1328
    -
    
    1329
    -Example of why (iii) is important:
    
    1330
    -  {-# INLINE [~1] g #-}
    
    1331
    -  g = ...
    
    1332
    -
    
    1333
    -  {-# INLINE f #-}
    
    1334
    -  f x = g (g x)
    
    1335
    -
    
    1336
    -If we were to inline g into f's inlining, then an importing module would
    
    1337
    -never be able to do
    
    1338
    -        f e --> g (g e) ---> RULE fires
    
    1339
    -because the stable unfolding for f has had g inlined into it.
    
    1340
    -
    
    1341
    -On the other hand, it is bad not to do ANY inlining into an
    
    1342
    -stable unfolding, because then recursive knots in instance declarations
    
    1343
    -don't get unravelled.
    
    1344
    -
    
    1345
    -However, *sometimes* SimplGently must do no call-site inlining at all
    
    1346
    -(hence sm_inline = False).  Before full laziness we must be careful
    
    1347
    -not to inline wrappers, because doing so inhibits floating
    
    1348
    -    e.g. ...(case f x of ...)...
    
    1349
    -    ==> ...(case (case x of I# x# -> fw x#) of ...)...
    
    1350
    -    ==> ...(case x of I# x# -> case fw x# of ...)...
    
    1351
    -and now the redex (f x) isn't floatable any more.
    
    1352
    -
    
    1353
    -The no-inlining thing is also important for Template Haskell.  You might be
    
    1354
    -compiling in one-shot mode with -O2; but when TH compiles a splice before
    
    1355
    -running it, we don't want to use -O2.  Indeed, we don't want to inline
    
    1356
    -anything, because the byte-code interpreter might get confused about
    
    1357
    -unboxed tuples and suchlike.
    
    1358
    -
    
    1359 1322
     Note [What is active in the RHS of a RULE or unfolding?]
    
    1360 1323
     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    1361 1324
     Suppose we have either a RULE or a stable unfolding with an explicit activation:
    
    ... ... @@ -1448,7 +1411,7 @@ First, consider the following example
    1448 1411
     Now, if that's the ONLY occurrence of f, it might be inlined inside g,
    
    1449 1412
     and thence copied multiple times when g is inlined. HENCE we treat
    
    1450 1413
     any occurrence in a stable unfolding as a multiple occurrence, not a single
    
    1451
    -one; see OccurAnal.addRuleUsage.
    
    1414
    +one; see Note [Occurrences in stable unfoldings and RULES] in GHC.Core.Opt.OccurAnal.
    
    1452 1415
     
    
    1453 1416
     Second, we must be careful when simplifying the RHS that we do not apply RULES
    
    1454 1417
     which are not active over the whole active range of the stable unfolding.
    
    ... ... @@ -1477,17 +1440,6 @@ strictness wrapper get activation (ActiveAfter 0). So the strictness
    1477 1440
     wrepper fails the test and won't be inlined into f's stable unfolding. That
    
    1478 1441
     means f can inline, expose the specialised call to g, so the specialisation
    
    1479 1442
     rules can fire.
    
    1480
    -
    
    1481
    -A note about wrappers
    
    1482
    -~~~~~~~~~~~~~~~~~~~~~
    
    1483
    -It's also important not to inline a worker back into a wrapper.
    
    1484
    -A wrapper looks like
    
    1485
    -        wraper = inline_me (\x -> ...worker... )
    
    1486
    -Normally, the inline_me prevents the worker getting inlined into
    
    1487
    -the wrapper (initially, the worker's only call site!).  But,
    
    1488
    -if the wrapper is sure to be called, the strictness analyser will
    
    1489
    -mark it 'demanded', so when the RHS is simplified, it'll get an ArgOf
    
    1490
    -continuation.
    
    1491 1443
     -}
    
    1492 1444
     
    
    1493 1445
     getUnfoldingInRuleMatch :: SimplEnv -> InScopeEnv
    
    ... ... @@ -2158,8 +2110,9 @@ tryEtaExpandRhs :: SimplEnv -> BindContext -> OutId -> OutExpr
    2158 2110
     tryEtaExpandRhs env bind_cxt bndr rhs
    
    2159 2111
       | seEtaExpand env         -- If Eta-expansion is on
    
    2160 2112
       , wantEtaExpansion rhs    -- and we'd like to eta-expand e
    
    2161
    -  , do_eta_expand           -- and e's manifest arity is lower than
    
    2162
    -                            --     what it could be
    
    2113
    +  , do_eta_expand           -- and arity analysis finds a greater arity
    
    2114
    +                            --     than (exprArity e); NB: not manifestArity
    
    2115
    +                            --     See Note [Do not eta-expand PAPs]
    
    2163 2116
                                 --     (never true for join points)
    
    2164 2117
       =                         -- Do eta-expansion.
    
    2165 2118
         assertPpr( not (isJoinBC bind_cxt) ) (ppr bndr) $
    
    ... ... @@ -2178,7 +2131,8 @@ tryEtaExpandRhs env bind_cxt bndr rhs
    2178 2131
         (do_eta_expand, arity_type) = findRhsArity arity_opts is_rec bndr rhs
    
    2179 2132
     
    
    2180 2133
     wantEtaExpansion :: CoreExpr -> Bool
    
    2181
    --- Mostly True; but False of PAPs which will immediately eta-reduce again
    
    2134
    +-- Mostly True; but False of trivial RHSs, and of PAPs at the top of the RHS
    
    2135
    +-- (PAPs under value lambdas are dealt with by findRhsArity)
    
    2182 2136
     -- See Note [Which RHSs do we eta-expand?]
    
    2183 2137
     wantEtaExpansion (Cast e _)             = wantEtaExpansion e
    
    2184 2138
     wantEtaExpansion (Tick _ e)             = wantEtaExpansion e
    
    ... ... @@ -2195,24 +2149,6 @@ We now eta expand at let-bindings, which is where the payoff comes.
    2195 2149
     The most significant thing is that we can do a simple arity analysis
    
    2196 2150
     (in GHC.Core.Opt.Arity.findRhsArity), which we can't do for free-floating lambdas
    
    2197 2151
     
    
    2198
    -One useful consequence of not eta-expanding lambdas is this example:
    
    2199
    -   genMap :: C a => ...
    
    2200
    -   {-# INLINE genMap #-}
    
    2201
    -   genMap f xs = ...
    
    2202
    -
    
    2203
    -   myMap :: D a => ...
    
    2204
    -   {-# INLINE myMap #-}
    
    2205
    -   myMap = genMap
    
    2206
    -
    
    2207
    -Notice that 'genMap' should only inline if applied to two arguments.
    
    2208
    -In the stable unfolding for myMap we'll have the unfolding
    
    2209
    -    (\d -> genMap Int (..d..))
    
    2210
    -We do not want to eta-expand to
    
    2211
    -    (\d f xs -> genMap Int (..d..) f xs)
    
    2212
    -because then 'genMap' will inline, and it really shouldn't: at least
    
    2213
    -as far as the programmer is concerned, it's not applied to two
    
    2214
    -arguments!
    
    2215
    -
    
    2216 2152
     Note [Which RHSs do we eta-expand?]
    
    2217 2153
     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    2218 2154
     We don't eta-expand:
    
    ... ... @@ -2234,7 +2170,22 @@ seems like a Good idea.
    2234 2170
     
    
    2235 2171
     Note [Do not eta-expand PAPs]
    
    2236 2172
     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    2237
    -We used to have old_arity = manifestArity rhs, which meant that we
    
    2173
    +We do not eta-expand a RHS that is a partial application (PAP).  This
    
    2174
    +is achieved in two places:
    
    2175
    +
    
    2176
    +(DEP1) A PAP at the top of the RHS, such as
    
    2177
    +          f = g d       -- g has arity 2
    
    2178
    +       is rejected by `wantEtaExpansion`.
    
    2179
    +
    
    2180
    +(DEP2) A PAP under value lambdas, such as
    
    2181
    +          f = \x. g x   -- g has arity 3
    
    2182
    +       is not eta-expanded because `findRhsArity` asks for eta-expansion
    
    2183
    +       only if the arity it finds is greater than (exprArity rhs), and
    
    2184
    +       `exprArity` takes account of PAPs: here (exprArity rhs) = 3.
    
    2185
    +       Using `manifestArity` (which is 1 here) instead would eta-expand
    
    2186
    +       to f = \x y z. g x y z.
    
    2187
    +
    
    2188
    +Up to 2014 we used old_arity = manifestArity rhs, which meant that we
    
    2238 2189
     would eta-expand even PAPs.  But this gives no particular advantage,
    
    2239 2190
     and can lead to a massive blow-up in code size, exhibited by #9020.
    
    2240 2191
     Suppose we have a PAP
    
    ... ... @@ -2250,6 +2201,17 @@ coercions and whatnot that eventually disappear again. For T9020, GHC
    2250 2201
     allocated 6.6G before, and 0.8G afterwards; and residency dropped from
    
    2251 2202
     1.8G to 45M.
    
    2252 2203
     
    
    2204
    +#27212 tried switching (DEP2) back to manifestArity, with these results:
    
    2205
    +
    
    2206
    +* T13960: bytestring's
    
    2207
    +      cstring1 = \(a::Addr#) @r. cstring2 @r a     -- cstring2 has arity 4
    
    2208
    +  was eta-expanded to (\a @r k br s. cstring2 @r a k br s).  That bigger
    
    2209
    +  unfolding is inlined at every string literal, adding 6 terms per
    
    2210
    +  literal; compile-time allocation went up by 9%.
    
    2211
    +
    
    2212
    +* T13056: a derived-instance method (\ @a d. lvl @a), where `lvl` is
    
    2213
    +  bottoming, was eta-expanded, and then needlessly worker/wrappered.
    
    2214
    +
    
    2253 2215
     Moreover, if we eta expand
    
    2254 2216
             f = g d  ==>  f = \x. g d x
    
    2255 2217
     that might in turn make g inline (if it has an inline pragma), which
    
    ... ... @@ -2261,6 +2223,24 @@ But note that this won't eta-expand, say
    2261 2223
     Does it matter not eta-expanding such functions?  I'm not sure.  Perhaps
    
    2262 2224
     strictness analysis will have less to bite on?
    
    2263 2225
     
    
    2226
    +One useful consequence of not eta-expanding PAPs is this example:
    
    2227
    +   genMap :: C a => ...
    
    2228
    +   {-# INLINE genMap #-}
    
    2229
    +   genMap f xs = ...
    
    2230
    +
    
    2231
    +   myMap :: D a => ...
    
    2232
    +   {-# INLINE myMap #-}
    
    2233
    +   myMap = genMap
    
    2234
    +
    
    2235
    +Notice that 'genMap' should only inline if applied to two arguments.
    
    2236
    +In the stable unfolding for myMap we'll have the unfolding
    
    2237
    +    (\d -> genMap Int (..d..))
    
    2238
    +We do not want to eta-expand to
    
    2239
    +    (\d f xs -> genMap Int (..d..) f xs)
    
    2240
    +because then 'genMap' will inline, and it really shouldn't: at least
    
    2241
    +as far as the programmer is concerned, it's not applied to two
    
    2242
    +arguments!
    
    2243
    +
    
    2264 2244
     
    
    2265 2245
     ************************************************************************
    
    2266 2246
     *                                                                      *
    

  • compiler/GHC/Core/Opt/SpecConstr.hs
    ... ... @@ -684,7 +684,7 @@ But regardless, SpecConstr can and should! It's easy:
    684 684
     Wrinkles:
    
    685 685
     
    
    686 686
     * This should all work perfectly fine for newtype classes.  Mind you,
    
    687
    -  currently newtype classes are inlined fairly agressively, but we
    
    687
    +  currently newtype classes are inlined fairly aggressively, but we
    
    688 688
       may change that. And it would take extra code to exclude them, as
    
    689 689
       well as being unnecessary.
    
    690 690
     
    

  • compiler/GHC/Core/Opt/Specialise.hs
    ... ... @@ -3345,7 +3345,7 @@ pair_fvs :: (Id, CoreExpr) -> VarSet
    3345 3345
     pair_fvs (bndr, rhs) = exprSomeFreeVars interesting rhs
    
    3346 3346
                            `unionVarSet` bndrFreeVars bndr
    
    3347 3347
             -- bndrFreeVars: don't forget variables mentioned in
    
    3348
    -        -- the rules of the bndr.  C.f. OccAnal.addRuleUsage
    
    3348
    +        -- the rules or unfolding of the bndr.
    
    3349 3349
             -- Also tyvars mentioned in its type; they may not appear
    
    3350 3350
             -- in the RHS
    
    3351 3351
             --      type T a = Int
    

  • compiler/GHC/Core/TyCo/Make.hs
    ... ... @@ -58,7 +58,7 @@ module GHC.Core.TyCo.Make (
    58 58
         , mkAxInstCo
    
    59 59
         , mkTransCo, mkTransMCo, mkTransMCoL, mkTransMCoR
    
    60 60
         , mkProofIrrelCo
    
    61
    -    , coToMCo, kindCoToMKindCo
    
    61
    +    , coToMCo, kindCoToMKindCo, mCoToCo
    
    62 62
         , mkCoherenceLeftCo, mkCoherenceRightCo, mkCoherenceRightMCo
    
    63 63
         , toPhantomCo, mkPhantomCo
    
    64 64
         , isReflCo, isReflMCo, isReflKindCo, isReflKindMCo, isReflCo_maybe
    
    ... ... @@ -860,7 +860,7 @@ mkHomoForAllCos vs orig_co
    860 860
       = foldr go orig_co vs
    
    861 861
       where
    
    862 862
         go :: ForAllTyBinder -> Coercion -> Coercion
    
    863
    -    go (Bndr var vis) co = mk_forall_co var vis vis MRefl co
    
    863
    +    go (Bndr var vis) co = mkForAllCoNonRefl var vis vis MRefl co
    
    864 864
     
    
    865 865
     mkHomoForAllCo :: TyVar -> Coercion -> Coercion
    
    866 866
     -- Specialised for a single TyVar,
    
    ... ... @@ -869,7 +869,7 @@ mkHomoForAllCo tv orig_co
    869 869
       | Just (ty, r) <- isReflCo_maybe orig_co
    
    870 870
       = mkReflCo r (mkForAllTy (Bndr tv vis) ty)
    
    871 871
       | otherwise
    
    872
    -  = mk_forall_co tv vis vis MRefl orig_co
    
    872
    +  = mkForAllCoNonRefl tv vis vis MRefl orig_co
    
    873 873
       where
    
    874 874
         vis  = coreTyLamForAllTyFlag
    
    875 875
     
    
    ... ... @@ -892,15 +892,15 @@ mkForAllCo v visL visR kind_co co
    892 892
       | Just refl_co <- isReflForAllCo v visL visR kind_co co
    
    893 893
       = refl_co
    
    894 894
       | otherwise
    
    895
    -  = mk_forall_co v visL visR kind_co co
    
    895
    +  = mkForAllCoNonRefl v visL visR kind_co co
    
    896 896
     
    
    897
    --- | `mk_forall_co` just builds a ForAllCo.
    
    897
    +-- | `mkForAllCoNonRefl` just builds a ForAllCo.
    
    898 898
     -- With debug on, it checks invariants (e.g. he kind of the tycovar should
    
    899 899
     --   be the left-hand kind of the kind coercion).
    
    900 900
     -- Callers should have done any isReflCo short-cutting.
    
    901
    -mk_forall_co :: TyCoVar -> ForAllTyFlag -> ForAllTyFlag
    
    902
    -             -> KindMCoercion -> Coercion -> Coercion
    
    903
    -mk_forall_co tcv visL visR kind_co co
    
    901
    +mkForAllCoNonRefl :: TyCoVar -> ForAllTyFlag -> ForAllTyFlag
    
    902
    +                  -> KindMCoercion -> Coercion -> Coercion
    
    903
    +mkForAllCoNonRefl tcv visL visR kind_co co
    
    904 904
       = assertGoodForAllCo tcv visL visR kind_co co $
    
    905 905
         assertPpr (not (isReflCo co && isReflMCo kind_co && visL `eqForAllVis` visR)) (ppr co) $
    
    906 906
         ForAllCo { fco_tcv = tcv, fco_visL = visL, fco_visR = visR
    
    ... ... @@ -1289,6 +1289,10 @@ coToMCo :: Coercion -> MCoercion
    1289 1289
     coToMCo co | isReflCo co = MRefl
    
    1290 1290
                | otherwise   = MCo co
    
    1291 1291
     
    
    1292
    +mCoToCo :: Role -> Type -> MCoercion -> Coercion
    
    1293
    +mCoToCo role ty MRefl    = mkReflCo role ty
    
    1294
    +mCoToCo _    _  (MCo co) = co
    
    1295
    +
    
    1292 1296
     kindCoToMKindCo :: KindCoercion -> KindMCoercion
    
    1293 1297
     -- Convert a KindCoercion to a KindMCoercion,
    
    1294 1298
     -- coToMCo doesn't eliminate GRefl, but kindCoToMCo can
    

  • compiler/GHC/Core/Type.hs
    ... ... @@ -160,7 +160,7 @@ module GHC.Core.Type (
    160 160
     
    
    161 161
             -- * Type free variables
    
    162 162
             tyCoVarsOfType, tyCoVarsOfTypes, tyCoVarsOfTypeDSet,
    
    163
    -        coVarsOfType, coVarsOfTypes,
    
    163
    +        tyCoVarsOfMCo, coVarsOfType, coVarsOfTypes,
    
    164 164
     
    
    165 165
             anyFreeVarsOfType, anyFreeVarsOfTypes,
    
    166 166
             noFreeVarsOfType,
    

  • compiler/GHC/Core/Utils.hs
    ... ... @@ -2392,7 +2392,7 @@ canCollectArgsThroughTick id t
    2392 2392
       = tickishFloatable t || cantEtaReduceFun id
    
    2393 2393
     
    
    2394 2394
     -- | Can we eta-reduce the given function?
    
    2395
    --- See Note [Eta reduction soundness], criteria (B), (J), and (W).
    
    2395
    +-- See Note [Eta reduction soundness], criteria (EtaB), (EtaJ), and (EtaW).
    
    2396 2396
     cantEtaReduceFun :: Id -> Bool
    
    2397 2397
     cantEtaReduceFun fun
    
    2398 2398
       =    hasNoBinding fun -- (B)
    
    ... ... @@ -3295,17 +3295,16 @@ Now
    3295 3295
        the caller guarantees to pass an EPT argument (see Note [EPT enforcement] in
    
    3296 3296
        GHC.Core.Stg.EnforceEpt)
    
    3297 3297
     
    
    3298
    - * The code generator will discard that "extra eval" case, because $wfoo is
    
    3299
    -   CBV.
    
    3298
    + * The code generator will discard that "extra eval" case, because $wfoo is CBV.
    
    3300 3299
     
    
    3301 3300
     See also Note [CBV Function Ids: overview].
    
    3302 3301
     
    
    3303
    -In tihs case the argument is known to be properly tagged at the call site so there is
    
    3302
    +In this case the argument is known to be properly tagged at the call site so there is
    
    3304 3303
     no additional work for the caller and the worker can be more efficient since it can
    
    3305 3304
     assume the presence of a tag.
    
    3306 3305
     
    
    3307 3306
     This is especially true for recursive functions like this:
    
    3308
    -    -- myPred expect it's argument properly tagged
    
    3307
    +    -- myPred expects its argument properly tagged
    
    3309 3308
         -- The EnforceEPT pass has made it a CBV function
    
    3310 3309
         myPred !x = ...
    
    3311 3310
     
    
    ... ... @@ -3414,16 +3413,17 @@ This note deals with the second part.
    3414 3413
     There are multiple reasons why we might not want to insert a seq in the rhs to
    
    3415 3414
     strictify a functions argument:
    
    3416 3415
     
    
    3417
    -1) The argument doesn't exist at runtime.
    
    3418
    -   For zero width types (like Types) there is no benefit as we don't operate on them
    
    3419
    -   at runtime at all. This includes things like void#, coercions and state tokens.
    
    3416
    +(WIS1) The argument doesn't exist at runtime: types are erased.
    
    3420 3417
     
    
    3421
    -2) The argument is a unlifted type.
    
    3422
    -   If the argument is a unlifted type the calling convention already is explicitly
    
    3418
    +(WIS2) For zero width types there is no benefit as we don't operate on them at
    
    3419
    +   runtime at all. This includes things like void#, coercions and state tokens.
    
    3420
    +
    
    3421
    +(WIS3) The argument is a unlifted type.
    
    3422
    +   If the argument is an unlifted type the calling convention already is explicitly
    
    3423 3423
        cbv. This means inserting a seq on this argument wouldn't do anything as the seq
    
    3424 3424
        would be a no-op *and* it wouldn't affect the calling convention.
    
    3425 3425
     
    
    3426
    -3) The argument is absent.
    
    3426
    +(WIS4) The argument is absent.
    
    3427 3427
        If the argument is absent in the body there is no advantage to it being passed as
    
    3428 3428
        cbv to the function. The function won't ever look at it so we don't save any work.
    
    3429 3429
     
    
    ... ... @@ -3445,7 +3445,7 @@ strictify a functions argument:
    3445 3445
        Note [Absent fillers] has an example of this. However this is so rare it's not worth
    
    3446 3446
        caring about here.
    
    3447 3447
     
    
    3448
    -5) Functions
    
    3448
    +(WIS5) Functions
    
    3449 3449
        Functions are tricky (see Note [TagInfo of functions] in EnforceEpt).
    
    3450 3450
        But the gist of it even if we make a higher order function argument strict
    
    3451 3451
        we can't avoid the tag check when it's used later in the body.
    
    ... ... @@ -3453,7 +3453,7 @@ strictify a functions argument:
    3453 3453
     
    
    3454 3454
     Wrinkles:
    
    3455 3455
     
    
    3456
    -(WIS1) You might have thought that we can omit the eval if the argument is used
    
    3456
    +(WIS6) You might have thought that we can omit the eval if the argument is used
    
    3457 3457
        strictly demanded in the body.  But you'd be wrong. Consider this code:
    
    3458 3458
               data T = MkT ![Int]
    
    3459 3459
               f t = case t of MkT xs{Dmd=STR} -> reverse xs
    
    ... ... @@ -3509,25 +3509,30 @@ Wrinkles:
    3509 3509
     wantCbvForId :: Var -> Bool
    
    3510 3510
     wantCbvForId v
    
    3511 3511
       -- Must be a runtime var.
    
    3512
    -  -- See Note [Which Ids should be strictified] point 1)
    
    3513
    -  | isId v
    
    3514
    -  , not $ isZeroBitTy ty
    
    3512
    +  -- See (WIS1) in Note [Which Ids should be strictified]
    
    3513
    +  | not (isRuntimeVar v) = False
    
    3514
    +
    
    3515
    +  -- Not zero-width value
    
    3516
    +  -- See (WIS2) in Note [Which Ids should be strictified]
    
    3517
    +  | isZeroBitTy ty = False
    
    3518
    +
    
    3515 3519
       -- Unlifted things don't need special measures to be treated as cbv
    
    3516
    -  -- See Note [Which Ids should be strictified] point 2)
    
    3517
    -  , mightBeLiftedType ty
    
    3520
    +  -- See (WIS3) in Note [Which Ids should be strictified]
    
    3521
    +  | definitelyUnliftedType ty = False
    
    3522
    +
    
    3523
    +  -- If the var is absent, don't add a seq
    
    3524
    +  -- See (WIS4) in Note [Which Ids should be strictified]
    
    3525
    +  | isAbsDmd (idDemandInfo v) = False
    
    3526
    +
    
    3518 3527
       -- Functions sometimes get a zero tag so we can't eliminate the tag check.
    
    3519 3528
       -- See Note [TagInfo of functions] in EnforceEpt.
    
    3520
    -  -- See Note [Which Ids should be strictified] point 5)
    
    3521
    -  , not $ isFunTy ty
    
    3522
    -  -- If the var is strict already a seq is redundant.
    
    3523
    -  -- See Note [Which Ids should be strictified] point 4)
    
    3524
    -  , not (isAbsDmd dmd)
    
    3525
    -  = True
    
    3526
    -  | otherwise
    
    3527
    -  = False
    
    3529
    +  -- See (WIS5) in Note [Which Ids should be strictified]
    
    3530
    +  | isFunTy ty = False
    
    3531
    +
    
    3532
    +  -- Finally!  We should add a `seq`
    
    3533
    +  | otherwise = True
    
    3528 3534
       where
    
    3529 3535
         ty = idType v
    
    3530
    -    dmd = idDemandInfo v
    
    3531 3536
     
    
    3532 3537
     {- *********************************************************************
    
    3533 3538
     *                                                                      *
    

  • compiler/GHC/Driver/Config/Core/Opt/Simplify.hs
    ... ... @@ -77,6 +77,7 @@ initSimplMode dflags phase name = SimplMode
    77 77
       }
    
    78 78
     
    
    79 79
     initGentleSimplMode :: DynFlags -> SimplMode
    
    80
    +-- See Note [The InitialPhase of the Simplifier] in GHC.Core.Opt.Pipeline
    
    80 81
     initGentleSimplMode dflags = (initSimplMode dflags InitialPhase "Gentle")
    
    81 82
       { -- Don't do case-of-case transformations.
    
    82 83
         -- This makes full laziness work better
    

  • compiler/GHC/Utils/Logger.hs
    ... ... @@ -485,7 +485,7 @@ dumpSDocWithStyle dumps log_action sty logflags flag hdr doc =
    485 485
                             let d = timeStamp
    
    486 486
                                     $$ blankLine
    
    487 487
                                     $$ doc
    
    488
    -                        return $ mkDumpDoc hdr d
    
    488
    +                        return $ mkDumpDoc herald d
    
    489 489
             -- When we dump to files we use UTF8. Which allows ascii spaces.
    
    490 490
             defaultLogActionHPrintDoc logflags True handle (withPprStyle sty doc')
    
    491 491
     
    
    ... ... @@ -493,9 +493,15 @@ dumpSDocWithStyle dumps log_action sty logflags flag hdr doc =
    493 493
         writeDump Nothing = do
    
    494 494
             let (doc', msg_class)
    
    495 495
                   | null hdr  = (doc, MCOutput)
    
    496
    -              | otherwise = (mkDumpDoc hdr doc, MCDump)
    
    496
    +              | otherwise = (mkDumpDoc herald doc, MCDump)
    
    497 497
             log_action logflags msg_class noSrcSpan (withPprStyle sty doc')
    
    498 498
     
    
    499
    +    -- We use a different herald for some dumps, so that we
    
    500
    +    -- can more easily skip the high-volume ones
    
    501
    +    herald = line <+> text hdr <+> line
    
    502
    +    line = case flag of
    
    503
    +             Opt_D_dump_simpl_trace -> text "-------"
    
    504
    +             _                      -> text "===================="
    
    499 505
     
    
    500 506
     -- | Run an action with the handle of a 'DumpFlag' if we are outputting to a
    
    501 507
     -- file, otherwise 'Nothing'.
    
    ... ... @@ -600,18 +606,17 @@ logTraceMsg logger hdr doc a = putTraceMsg logger (logFlags logger) hdr doc a
    600 606
     
    
    601 607
     -- | Log a dump message (not a dump file)
    
    602 608
     logDumpMsg :: Logger -> String -> SDoc -> IO ()
    
    603
    -logDumpMsg logger hdr doc = logMsg logger MCDump noSrcSpan
    
    604
    -  (withPprStyle defaultDumpStyle
    
    605
    -  (mkDumpDoc hdr doc))
    
    606
    -
    
    607
    -mkDumpDoc :: String -> SDoc -> SDoc
    
    608
    -mkDumpDoc hdr doc
    
    609
    -   = vcat [blankLine,
    
    610
    -           line <+> text hdr <+> line,
    
    611
    -           doc,
    
    612
    -           blankLine]
    
    613
    -     where
    
    614
    -        line = text "===================="
    
    609
    +logDumpMsg logger hdr doc
    
    610
    +  = logMsg logger MCDump noSrcSpan
    
    611
    +           (withPprStyle defaultDumpStyle
    
    612
    +           (mkDumpDoc herald doc))
    
    613
    +  where
    
    614
    +    herald = text "------" <+> text hdr <+> text "------"
    
    615
    +
    
    616
    +mkDumpDoc :: SDoc  -- Herald
    
    617
    +          -> SDoc  -- Payload
    
    618
    +          -> SDoc
    
    619
    +mkDumpDoc herald doc = vcat [blankLine, herald, doc, blankLine]
    
    615 620
     
    
    616 621
     
    
    617 622
     -- | Dump if the given DumpFlag is set
    

  • compiler/Language/Haskell/Syntax/Binds/InlinePragma.hs
    ... ... @@ -124,11 +124,15 @@ Note [inl_inline and inl_act]
    124 124
       INLINABLE, OPAQUE, or nothing at all
    
    125 125
     
    
    126 126
     * inl_act says in what phases the unfolding is active or inactive
    
    127
    -  E.g  If you write INLINE[1]    then inl_act will be set to ActiveAfter 1
    
    128
    -       If you write NOINLINE[1]  then inl_act will be set to ActiveBefore 1
    
    129
    -       If you write NOINLINE[~1] then inl_act will be set to ActiveAfter 1
    
    130
    -  So note that inl_act does not say what pragma you wrote: it just
    
    131
    -  expresses its consequences
    
    127
    +  E.g  If you write        then inl_act will be set to
    
    128
    +           INLINE           AlwaysActive
    
    129
    +           INLINE[1]        ActiveAfter 1
    
    130
    +           INLINE[~1]       ActiveBefore 1
    
    131
    +           NOINLINE[1]      ActiveAfter 1
    
    132
    +           NOINLINE[~1]     ActiveBefore 1
    
    133
    +           NOINLINE         NeverActive
    
    134
    +  So note that inl_act does not say what pragma you wrote:
    
    135
    +  it just expresses its consequences
    
    132 136
     
    
    133 137
     * inl_act just says when the unfolding is active; it doesn't say what
    
    134 138
       to inline.  If you say INLINE f, then f's inl_act will be AlwaysActive,
    

  • docs/users_guide/debug-info.rst
    ... ... @@ -69,8 +69,9 @@ Here we used the ``-g`` option to inform GHC that it should add debugging
    69 69
     information in the produced binary. There are three levels of debugging
    
    70 70
     output: ``-g0`` (no debugging information, the default), ``-g1`` (sufficient for
    
    71 71
     basic backtraces), ``-g2`` (or just ``-g`` for short; emitting everything GHC knows).
    
    72
    -Note that this debugging information does not affect the optimizations performed
    
    73
    -by GHC.
    
    72
    +Note that this debugging information does not affect the optimizations
    
    73
    +that GHC attempts to perform; but it can affect how successful it is in
    
    74
    +performing them (see #21471, #27687).
    
    74 75
     
    
    75 76
     .. tip::
    
    76 77
        Under Mac OS X debug information is kept apart from the executable. After
    

  • docs/users_guide/using-optimisation.rst
    ... ... @@ -1817,7 +1817,7 @@ as such you shouldn't need to set any of them explicitly. A flag
    1817 1817
         :type: dynamic
    
    1818 1818
         :category:
    
    1819 1819
     
    
    1820
    -    :default: 80
    
    1820
    +    :default: 90
    
    1821 1821
     
    
    1822 1822
         .. index::
    
    1823 1823
            single: inlining, controlling
    

  • testsuite/tests/dmdanal/sigs/T21888a.stderr
    ... ... @@ -7,7 +7,7 @@ T21888a.wombat: <S!P(S)>b
    7 7
     
    
    8 8
     
    
    9 9
     ==================== Cpr signatures ====================
    
    10
    -T21888a.f: 2
    
    10
    +T21888a.f:
    
    11 11
     T21888a.g: 1
    
    12 12
     T21888a.wombat: b
    
    13 13
     
    

  • testsuite/tests/printer/T18052a.stderr
    ... ... @@ -10,11 +10,11 @@ Dependent packages: [(normal, base-4.23.0.0)]
    10 10
     
    
    11 11
     ==================== Tidy Core ====================
    
    12 12
     Result size of Tidy Core
    
    13
    -  = {terms: 24, types: 52, coercions: 0, joins: 0/0}
    
    13
    +  = {terms: 18, types: 46, coercions: 0, joins: 0/0}
    
    14 14
     
    
    15
    --- RHS size: {terms: 7, types: 6, coercions: 0, joins: 0/0}
    
    15
    +-- RHS size: {terms: 1, types: 0, coercions: 0, joins: 0/0}
    
    16 16
     T18052a.$b:||: :: forall {a} {b}. a -> b -> (a, b)
    
    17
    -T18052a.$b:||: = \ (@a) (@b) (x :: a) (y :: b) -> (x, y)
    
    17
    +T18052a.$b:||: = GHC.Internal.Tuple.(,)
    
    18 18
     
    
    19 19
     -- RHS size: {terms: 1, types: 0, coercions: 0, joins: 0/0}
    
    20 20
     (+++) :: forall {a}. [a] -> [a] -> [a]
    

  • testsuite/tests/simplCore/should_compile/T24726.stderr
    1 1
     
    
    2
    -==================== Rule check ====================
    
    2
    +------ Rule check ------
    
    3 3
     Rule check results:
    
    4 4
     --------------------
    
    5 5
     Expression: concatMapS @(*) @Int @Int foo1
    
    ... ... @@ -8,7 +8,7 @@ Rule "concatMap": all arguments match (considered individually), but rule as a w
    8 8
     
    
    9 9
     
    
    10 10
     
    
    11
    -==================== Rule check ====================
    
    11
    +------ Rule check ------
    
    12 12
     Rule check results:
    
    13 13
     --------------------
    
    14 14
     Expression: concatMapS @(*) @Int @Int foo1
    
    ... ... @@ -17,7 +17,7 @@ Rule "concatMap": all arguments match (considered individually), but rule as a w
    17 17
     
    
    18 18
     
    
    19 19
     
    
    20
    -==================== Rule check ====================
    
    20
    +------ Rule check ------
    
    21 21
     Rule check results:
    
    22 22
     --------------------
    
    23 23
     Expression: concatMapS @(*) @Int @Int foo1
    
    ... ... @@ -26,7 +26,7 @@ Rule "concatMap": all arguments match (considered individually), but rule as a w
    26 26
     
    
    27 27
     
    
    28 28
     
    
    29
    -==================== Rule check ====================
    
    29
    +------ Rule check ------
    
    30 30
     Rule check results:
    
    31 31
     --------------------
    
    32 32
     Expression: concatMapS @(*) @Int @Int foo1
    

  • testsuite/tests/simplCore/should_compile/T27212.hs
    1
    +{-# OPTIONS_GHC -Wno-inaccessible-code  -Wno-overlapping-patterns #-}
    
    2
    +module T27212 where
    
    3
    +
    
    4
    +import Unsafe.Coerce
    
    5
    +
    
    6
    +class Given a where given :: a
    
    7
    +newtype Gift a r = Gift (Given a => r)
    
    8
    +
    
    9
    +useIt :: Given Int => Int
    
    10
    +useIt = given + 1
    
    11
    +{-# NOINLINE useIt #-}
    
    12
    +
    
    13
    +foo :: [Int] -> [Int]
    
    14
    +foo xs = case unsafeEqualityProof @(Gift Int Int) @(Int -> Int) of
    
    15
    +  UnsafeRefl -> map (\y -> (Gift useIt :: Gift Int Int) y) xs
    
    16
    +    -- That (\y. glah y) can eta-reduce to `glah`
    
    17
    +    -- but doing so makes a FunCo coercion that crosses from
    
    18
    +    -- Type to constraint. Tricky.

  • testsuite/tests/simplCore/should_compile/all.T
    ... ... @@ -631,3 +631,4 @@ test('T27936', normal, compile, [''])
    631 631
     test('T27910', grep_errmsg(r'KnownBranch'), compile, ['-O -dno-typeable-binds -ddump-simpl-stats -dsuppress-uniques'])
    
    632 632
     test('T27892', grep_errmsg(r'^f = g$'), compile, ['-O -ddump-cse -dsuppress-all -dsuppress-uniques'])
    
    633 633
     test('T28095a', grep_errmsg(r'^f = g$'), compile, ['-O -ddump-cse -dsuppress-all -dsuppress-uniques'])
    
    634
    +test('T27212', normal, compile, ['-O'])