Sylvain Henry pushed to branch wip/andreask/cfg-fix at Glasgow Haskell Compiler / GHC Commits: 3a72b8a2 by Hannes Siebenhandl at 2026-10-14T13:48:32-04:00 Fix #27836, normalise unit database path in ExternalUnitDatabases Add a regression test, proofing that all variations: - local-unit-db/my-test.conf - ./local-unit-db/my-test.conf - ./local-unit-db/my-test.conf/ are parsed only once. - - - - - 8ddbc6f9 by Florian Ragwitz at 2026-10-14T13:49:28-04:00 Remove obsolete HPC types Fixes #27946. - - - - - f34c79ee by Alan Zimmerman at 2026-10-15T04:54:47-04:00 EPA: Start using vocurly as basis for AnnListLayout For the existing cases that populate AnnList. This uses AnnListBraces when braces are explicitly supplied, and AnnListLayout when vocurly is used The change also shows up AnnList usages that can never capture layout, these are cleared up later. - - - - - 033ba59c by sheaf at 2026-10-15T04:55:44-04:00 Make exprFreeVars deep exprFreeVars used to be a shallow free-variable finder (it didn't look into kinds), but most callers wanted it to be deep. In particular, 'exprFreeVars' is often used to seed an 'InScopeSet', and that must contain the /deep/ free variables. This commit makes it deep, which allows us to get rid of calls to 'closeOverKinds' or other workarounds for shallowness in: - 'GHC.Core.Opt.Simplify.Utils.abstractFloats' - 'GHC.HsToCore.Binds.dsSpec_help' - 'GHC.Core.Opt.Arity.etaBodyForJoinPoint' - 'GHC.Core.FVs.freeVars' - 'GHC.Core.Lint.lintCoreRule' We also remove 'deepExprsFreeVarsDSet' and 'closeOverKindsDSet'. Other places needed a little bit more care, in particular to properly handle coercion variables free in kinds: - 'GHC.Core.Opt.Specialise.specHeader' quantifies over the binder of an unspecialised argument directly, instead of computing the free Ids of the argument. - 'GHC.HsToCore.dsWarnRuleShadowing' filters out 'CoVar's. - 'GHC.Core.Opt.SpecConstr.callToPat' had some ad-hoc logic to compute argument pattern types and a workaround with 'expandTypeSynonyms'. That logic is removed in favour of a new 'argsToPats' function which directly computes the argument pattern types by instantiating the type of the head of the call pattern. Fixes #27936 - - - - - f93d523c by Luite Stegeman at 2026-10-15T04:56:34-04:00 testsuite: Use mkWeakMVar in memo001/memo002 mkWeakPtr in the memo001/memo001 tests created weak pointers with the MVar box as the key, which is fragile in the presence of optimization. The fix is using mkWeakMVar, keying on the primitive MVar# instead. Fixes #27924 and #27396 - - - - - b24112fd by Andreas Klebinger at 2026-10-16T22:15:01+02:00 x86 ncg: Track the current block in NatM to keep the CFG in sync The x86 NCG maintains a CFG that is used for code layout. Whenever instruction selection introduces new basic blocks (for instance for word-to-float conversions, cmpxchg based atomic operations, ctz on i386 or 64-bit shifts on i386) it must update this CFG, and the code that follows must use the new block as its origin. Before this patch the current block was threaded explicitly through some statement-level functions only. Block-introducing primops that were dispatched as "simple" (word2Float#, #27915) and the 64-bit shifts in iselExpr64 did not update the CFG at all. This resulted in an out-of-sync CFG, bad code layout and the "Can't find weight for edge that should have one" panic once the register allocator inserted fixup blocks (#27694, #27915). We now keep the current block in the NatM state and provide a few combinators (continueInNewBlock, addCondBlock, addDiamondFlow, addColdSelfLoop, increaseEdgeWeight) that update the CFG and the current block at the same time. See Note [Updating the CFG during CodeGen] in GHC.CmmToAsm.Monad. The cfg sanity check (-dasm-lint) now also checks that all branches in the generated code have a matching edge in the CFG, which catches this class of bug early. It immediately found another desync: when the register allocator needs more stack than preallocated, allocMoreStack moves the body of every entry block into a new block and retargets the local jumps to it, but the CFG only recorded the new block as the immediate successor of the entry block. The new addPreentryBlock also redirects the jump edges (and keeps the call edges, since returns still go through the entry block). Fixes #27694, #27915 Co-authored-by: Sylvain Henry <sylvain@haskus.fr> Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> - - - - - 51 changed files: - + changelog.d/27694 - + changelog.d/27936 - + changelog.d/hpc-cleanup - changelog.d/unit-index - compiler/GHC/CmmToAsm.hs - compiler/GHC/CmmToAsm/BlockLayout.hs - compiler/GHC/CmmToAsm/CFG.hs - compiler/GHC/CmmToAsm/Monad.hs - compiler/GHC/CmmToAsm/X86/CodeGen.hs - compiler/GHC/CmmToAsm/X86/Instr.hs - compiler/GHC/Core/FVs.hs - compiler/GHC/Core/Lint.hs - compiler/GHC/Core/Opt/Arity.hs - compiler/GHC/Core/Opt/Simplify/Utils.hs - compiler/GHC/Core/Opt/SpecConstr.hs - compiler/GHC/Core/Opt/Specialise.hs - compiler/GHC/Core/Subst.hs - compiler/GHC/Core/TyCo/FVs.hs - compiler/GHC/Core/Type.hs - compiler/GHC/CoreToIface.hs - compiler/GHC/CoreToStg.hs - compiler/GHC/Data/OsPath.hs - compiler/GHC/HsToCore.hs - compiler/GHC/HsToCore/Binds.hs - compiler/GHC/Parser.y - compiler/GHC/StgToJS/ExprCtx.hs - compiler/GHC/Tc/Utils/TcType.hs - compiler/GHC/Types/Id/Info.hs - compiler/GHC/Types/Var/FV.hs - compiler/GHC/Unit/External/Database.hs - libraries/base/tests/Memo1.lhs - libraries/base/tests/Memo2.lhs - libraries/base/tests/all.T - + testsuite/tests/codeGen/should_compile/T27694.hs - testsuite/tests/codeGen/should_compile/all.T - + testsuite/tests/codeGen/should_run/T27915.hs - + testsuite/tests/codeGen/should_run/T27915.stdout-ws-32 - + testsuite/tests/codeGen/should_run/T27915.stdout-ws-64 - testsuite/tests/codeGen/should_run/all.T - + testsuite/tests/driver/T27836/A.hs - + testsuite/tests/driver/T27836/B.hs - + testsuite/tests/driver/T27836/C.hs - + testsuite/tests/driver/T27836/Makefile - + testsuite/tests/driver/T27836/T27836.stdout - + testsuite/tests/driver/T27836/all.T - + testsuite/tests/driver/T27836/unitA - + testsuite/tests/driver/T27836/unitB - + testsuite/tests/driver/T27836/unitC - testsuite/tests/parser/should_compile/DumpSemis.stderr - + testsuite/tests/simplCore/should_compile/T27936.hs - testsuite/tests/simplCore/should_compile/all.T The diff was not included because it is too large. View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/c56aa4177c05d2d3b0e7f1fc22df66b... -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/c56aa4177c05d2d3b0e7f1fc22df66b... You're receiving this email because of your account on gitlab.haskell.org. Manage all notifications: https://gitlab.haskell.org/-/profile/notifications | Help: https://gitlab.haskell.org/help
participants (1)
-
Sylvain Henry (@hsyl20)