Marge Bot pushed to branch wip/marge_bot_batch_merge_job at Glasgow Haskell Compiler / GHC Commits: 2908ab36 by Simon Jakobi at 2026-09-05T07:22:17-04:00 X86 NCG: use btr/bts/btc for single-bit operations Previously the Cmm patterns x & ~(1 << i) x | (1 << i) x ^ (1 << i) compiled to mov/shl/not/and-style sequences of 3-4 instructions. Now they compile to a single btr, bts or btc, matching what C compilers produce. When the bit index is a literal, constant folding has already collapsed these patterns into ones with a literal mask, such as x & 0xfffffeffffffffff for x & ~(1 << 40). Such masks are now also compiled to a bit-test instruction when they don't fit in an imm32 and would otherwise have to be loaded into a register first. For a variable bit index, this applies only when the shift is unchecked (uncheckedShiftL#, Data.Bits.unsafeShiftL): the bounds-checked shiftL used by e.g. the default clearBit/setBit/complementBit implementations wraps the shift in a bounds mask that this optimisation does not see through. With a literal index, the bounds mask is constant-folded away, so the checked operations benefit too. See Note [Bit-test instructions] in GHC.CmmToAsm.X86.CodeGen. Fixes #25233. Assisted-by: Claude Fable 5 - - - - - c673ecf0 by Simon Peyton Jones at 2026-09-05T07:22:59-04:00 Move HsStatic free-var test to typechecker A `static` form should have no free *term* variables, but it can have free *type* variables. Alas, the renamer does not really know what is a term variable and what is a type variable, because of required type arguments. This patch moves the test to the typechecker, which does know. Addresses #27664 - - - - - 92b878ce by sheaf at 2026-09-05T07:55:33-04:00 Windows: enforce path convention in ./configure As detailed in Note [MSYS paths] in Hadrian.Utilities, the standing convention (using Windows-style paths with forward slashes) is now enforced in ./configure instead of within Hadrian, removing the need for 'cygpath' calls within Hadrian. Fixes #26683 - - - - - b3d9abd1 by sheaf at 2026-09-05T07:55:33-04:00 Hadrian: introduce ExeSpawnPath Specific details about the filepath used to specify the executable to spawn with CreateProcess matters on Windows: whether we use forward or backward slashes, a leading ./, or an absolute path changes how the executable is found. This commit introduces 'ExeSpawnPath' which is a path that is guaranteed to be found when spawning a process. All command invocations now go through this type to ensure the path has been properly sanitised. See Note [NeedCurrentDirectoryForExePath] in Hadrian.Utilities. The same treatment is applied to hsc2hs. Updates hsc2hs submodule. - - - - - d0d07cf1 by sheaf at 2026-09-05T07:55:37-04:00 Preserve tick ordering in 'tickTickedExpr' 'GHC.Core.Utils.tickTickedExpr' tries to combine a tick 't1' into an existing stack of ticks 't2s'. There are two situations: 1. 't1' is subsumed by a tick in 't2s': drop it. 2. A tick in 't2s' is subsumed by 't1', say 't2'. This commit ensures that in case (2) we keep 't1' on the outside instead of replacing 't2' at its position in the stack. This avoids re-ordering source notes (which was the cause of #27749). This fixes a regression introduced in 2dadf3b0d05. Fixes #27749 - - - - - dd0ec867 by sheaf at 2026-09-05T07:55:37-04:00 Consistently prefer local source note ticks GHC.Cmm.DebugBlock.cmmDebugGen (DWARF annotations) and GHC.Stg.Debug.quickSourcePos (-finfo-table-map) both contained logic to prioritise source note ticks from the current module. This commit commons up this logic and propagates it to a third consumer: IPE stack frames, in GHC.Driver.GenerateCgIPEStub. See the new function GHC.Types.Tickish.bestSourceNote. - - - - - 53 changed files: - + changelog.d/T27749 - + changelog.d/T27764 - + changelog.d/ncg-x86-bit-test-instructions - compiler/GHC/Cmm/DebugBlock.hs - compiler/GHC/CmmToAsm/X86/CodeGen.hs - compiler/GHC/CmmToAsm/X86/Instr.hs - compiler/GHC/CmmToAsm/X86/Ppr.hs - compiler/GHC/Core/Utils.hs - compiler/GHC/Driver/GenerateCgIPEStub.hs - compiler/GHC/Driver/Main/Compile.hs - compiler/GHC/Hs/Expr.hs - compiler/GHC/Rename/Expr.hs - compiler/GHC/Stg/Debug.hs - compiler/GHC/Tc/Gen/Expr.hs - compiler/GHC/Types/Tickish.hs - configure.ac - hadrian/src/Base.hs - hadrian/src/Builder.hs - hadrian/src/Hadrian/Builder.hs - hadrian/src/Hadrian/Builder/Ar.hs - hadrian/src/Hadrian/Oracles/Path.hs - hadrian/src/Hadrian/Utilities.hs - hadrian/src/Oracles/Setting.hs - hadrian/src/Oracles/TestSettings.hs - hadrian/src/Rules/BinaryDist.hs - hadrian/src/Rules/Changelog.hs - hadrian/src/Rules/Codes.hs - hadrian/src/Rules/Lint.hs - hadrian/src/Rules/Nofib.hs - hadrian/src/Rules/Test.hs - m4/find_python.m4 - + m4/fp_canonicalise_win_path.m4 - m4/fp_find_nm.m4 - m4/fp_find_root.m4 - m4/fp_prog_ar.m4 - m4/fp_prog_ar_args.m4 - m4/fp_prog_sh.m4 - m4/fptools_alex.m4 - m4/fptools_happy.m4 - + testsuite/tests/codeGen/should_gen_asm/T25233.asm - + testsuite/tests/codeGen/should_gen_asm/T25233.hs - + testsuite/tests/codeGen/should_gen_asm/T25233b.asm - + testsuite/tests/codeGen/should_gen_asm/T25233b.cmm - testsuite/tests/codeGen/should_gen_asm/all.T - testsuite/tests/rename/should_fail/RnStaticPointersFail01.stderr - testsuite/tests/rename/should_fail/RnStaticPointersFail03.stderr - testsuite/tests/rename/should_fail/T26545.stderr - + testsuite/tests/simplCore/should_compile/T27749.hs - + testsuite/tests/simplCore/should_compile/T27749.stderr - testsuite/tests/simplCore/should_compile/all.T - + testsuite/tests/typecheck/should_compile/T27664.hs - testsuite/tests/typecheck/should_compile/all.T - utils/hsc2hs The diff was not included because it is too large. View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/c396d8cbb1828c84ce08376c8d3f6d2... -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/c396d8cbb1828c84ce08376c8d3f6d2... 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