- Oct 18, 2024
-
-
Cheng Shao authored
This patch fixes missing -ddump-cmm-raw output when compiling .cmm, which is useful for debugging cmm related codegen issues. (cherry picked from commit 6346c669) (cherry picked from commit e5a1dd43)
-
Cheng Shao authored
This patch removes special consideration for ArchWasm32 in cmmDoCmmSwitchPlans, which means the compiler will now disable cmmImplementSwitchPlans for wasm unreg backend, just like unreg backend of other targets. We enabled it in the past to workaround some compile-time panic in older versions of LLVM, but those panics are no longer present, hence no need to keep this workaround. (cherry picked from commit bf0737c0) (cherry picked from commit 8bd28cf2)
-
Cheng Shao authored
When -fsplit-sections is passed to GHC, pass -ffunction-sections -fdata-sections to gcc/clang when building C/C++. Previously, -fsplit-sections was only respected by the NCG/LLVM backends, but not the unregisterised backend; the GHC driver did not pass -fdata-sections and -ffunction-sections to the C compiler, which resulted in excessive executable sizes. Fixes #23381. ------------------------- Metric Decrease: size_hello_artifact size_hello_unicode ------------------------- (cherry picked from commit 02b1f91e) (cherry picked from commit 74cdf564)
-
Cheng Shao authored
This patch makes the STG->Cmm backend avoid saving foreign call target to local when there are no caller-save GlobalRegs. Since 321941a8, when we lower a foreign call, we unconditionally save the foreign call target to a temporary local first, then rely on cmmSink to clean it up later, which only happens with -fcmm-sink (implied by -O) and not in unoptimized code. And this is troublesome for the wasm backend NCG, which needs to infer a foreign call target symbol's type signature from the Cmm call site. Previously, the NCG has been emitting incorrect type signatures for unoptimized code, which happens to work with `wasm-ld` most of the time, but this is never future-proof against upstream toolchain updates, and it causes horrible breakages when LTO objects are included in linker input. Hence this patch. (cherry picked from commit 8dd8a076) (cherry picked from commit 2b2a3db8)
-
Cheng Shao authored
This commit enables the generic cmm optimizations in other NCGs to be run in the wasm backend as well, followed by a late cmm control-flow optimization pass. The added optimizations do catch some corner cases not handled by the pre-NCG cmm pipeline and are useful in generating smaller CFGs. (cherry picked from commit c6ce242e)
-
Cheng Shao authored
This commit explicitly disables the ncgPIC flag for the wasm32 target. The wasm backend doesn't support PIC for the time being. (cherry picked from commit 87e34888)
-
Cheng Shao authored
This commit moves GHC.CmmToAsm.cmmToCmm to a standalone module, GHC.Cmm.GenericOpt. The main motivation is enabling this logic to be run in the wasm backend NCG code, which is defined in other modules that's imported by GHC.CmmToAsm, causing a cyclic dependency issue. (cherry picked from commit 6534da24)
-
- Oct 15, 2024
-
-
Ben Gamari authored
There are objections raised on the MR (!13237) and the interface change makes me rather uncomfortable. This reverts commit fb82ee70.
-
- Oct 14, 2024
-
-
Ben Gamari authored
This commit was wrong, as noted in the `master` revert cfeb70d3. It appears to have ultimately been superceded by 0fe2b410 which is already present in `ghc-9.8`. This reverts commit 44e119c9.
-
(cherry picked from commit 09d24d82)
-
(cherry picked from commit 0dfaeb66)
-
This MR fixes #25325 See GHC.Tc.Types.Constraint, Note [Insoluble Wanteds], especially (IW2) There is a small change in the error message for T14172, but it looks entirely acceptable to me. (cherry picked from commit 083703a1)
-
For consistency with the NCG as well as with Clang and GCC, we make the SSE4.2 feature flag imply +popcnt when using the LLVM backend. Fixes #25353 (cherry picked from commit 06ae8507)
-
LLVM expects the former instead of the latter since version 3.4. Fixes #25019 (cherry picked from commit 694489ed)
-
GHC was outright crashing before this fix: #24604 (cherry picked from commit faa30b41)
-
This patch makes the driver always merge objects with `ld -r` when possible, and only fall back to calling `ar -L` when merge objects command is unavailable. This completely reverts !8887 and !12313, given more fixes in Cabal seems to be needed to avoid breaking certain configurations and the maintainence cost is exceeding the behefits in this case :/ (cherry picked from commit 631cefec)
-
- Oct 11, 2024
-
-
This commit makes the symbol cache that was used by the external interpreter available for the internal interpreter too. This follows from the analysis in #23415 that suggests the internal interpreter could benefit from this cache too, and that there is no good reason not to have the cache for it too. It also makes it a bit more uniform to have the symbol cache range over both the internal and external interpreter. This commit also refactors the cache into a function which is used by both `lookupSymbol` and also by `lookupSymbolInDLL`, extending the caching logic to `lookupSymbolInDLL` too.
-
See the primary Note [Looking up symbols in the relevant objects] for a more in-depth explanation. When dynamically loading a Haskell symbol (typical when running a splice or GHCi expression), before this commit we would search for the symbol in all dynamic libraries that were loaded. However, this could be very inefficient when too many packages are loaded (which can happen if there are many package dependencies) because the time to lookup the would be linear in the number of packages loaded. This commit drastically improves symbol loading performance by introducing a mapping from units to the handles of corresponding loaded dlls. These handles are returned by dlopen when we load a dll, and can then be used to look up in a specific dynamic library. Looking up a given Name is now much more precise because we can get lookup its unit in the mapping and lookup the symbol solely in the handles of the dynamic libraries loaded for that unit. In one measurement, the wait time before the expression was executed went from +-38 seconds down to +-2s. This commit also includes Note [Symbols may not be found in pkgs_loaded], explaining the fallback to the old behaviour in case no dll can be found in the unit mapping for a given Name. Fixes #23415 Co-authored-by:
Rodrigo Mesquita <(@alt-romes)> (cherry picked from commit e008a19a)
-
- Oct 10, 2024
-
-
Andreas Klebinger authored
When checking if a jump has more than one destination account for the possibility of some jumps not being representable by a BlockId. We do so by having isJumpishInstr return a `Maybe BlockId` where Nothing represents non-BlockId jump destinations. Fixes #24507 (cherry picked from commit 5bd8ed53)
-
- Oct 04, 2024
-
-
Uses responseFile syntax. The issue arises when GHC is installed on windows into a location that has a space, for example the user name is 'Fake User'. The $topdir will also contain a space, consequentially. When we resolve the top dir in the string `-I$topdir/mingw/include`, then `words` will turn this single argument into `-I/C/Users/Fake` and `User/.../mingw/include` which trips up the flag argument parser of various tools such as gcc or clang. We avoid this by escaping the $topdir before replacing it in `initSettngs`. Additionally, we allow to escape spaces and quotation marks for arguments in `settings` file. Add regression test case to count the number of options after variable expansion and argument escaping took place. Additionally, we check that escaped spaces and double quotation marks are correctly parsed. (cherry picked from commit 31bf85ee) (cherry picked from commit d74ffbbb)
-
Omitting this caused type inference to fail in #24146. This was an accidental omision in my refactoring of the equality solver.
-
Andreas Klebinger authored
Check for ptr/int arguments rather than 64-bit width arguments when counting integer register arguments. The old approach broke when we stopped using exclusively W64-sized types to represent sub-word sized integers. Fixes #24314 (cherry picked from commit de589554)
-
- Sep 30, 2024
-
-
8168b42a "Whitespace-sensitive bang patterns" allows GHC to accept the following infix operators: a ~ b = () a @ b = () But not if TH is used to generate those declarations: $([d| a ~ b = () a @ b = () |]) -- Test.hs:5:2: error: [GHC-55017] -- Illegal variable name: ‘~’ -- When splicing a TH declaration: (~_0) a_1 b_2 = GHC.Tuple.Prim.() This is easily fixed by modifying `reservedOps` in GHC.Utils.Lexeme (cherry picked from commit 46fd8ced)
-
Andreas Klebinger authored
Fix a bug in the x86 ncg where results would be wrong when the desired output register and one of the input registers were the same global. Also adds a tiny optimization to make use of the memory addressing support when convenient. Fixes #24496 (cherry picked from commit 82ccb801)
-
Zubin authored
The implementation of `checkHomeUnitsClosed` was traversing every single path in the unit dependency graph - this grows exponentially and quickly grows to be infeasible on larger unit dependency graphs. Instead we replace this with a faster implementation which follows from the specificiation of the closure property - there is a closure error if there are units which are both are both (transitively) depended upon by home units and (transitively) depend on home units, but are not themselves home units. To compute the set of units required for closure, we first compute the closure of the unit dependency graph, then the transpose of this closure, and find all units that are reachable from the home units in the transpose of the closure. (cherry picked from commit a933aff3)
-
(cherry picked from commit 0c4a9686)
-
Sylvain Henry authored
The optimization introducing h$appendToHsString wasn't kicking in anymore (while it did in 9.8.1) because of the changes introduced in #23270 (7e0c8b3b). This patch reenables the optimization by matching on case-expression, as done in Cmm for unpackCString# standard thunks. The test is also T24495 added in the next commits (two commits for ease of backporting to 9.8). (cherry picked from commit b36ee57b)
-
Ben Gamari authored
Fixes #24601. (cherry picked from commit f8f384a8)
-
(cherry picked from commit 28009fbc)
-
Andreas Klebinger authored
Add a new method to the Instruction class to check if we can eliminate a jump in favour of fallthrough control flow. Fixes #24507 (cherry picked from commit 0fe2b410)
-
Previously, the logic for checking if a data constructor needs a wrapper or not would take into account whether the constructor's fields have explicit strictness (e.g., `data T = MkT !Int`), but the logic would _not_ take into account whether `StrictData` was enabled. This meant that something like `type data T = MkT Int` would incorrectly generate a wrapper for `MkT` if `StrictData` was enabled, leading to the horrible errors seen in #24620. To fix this, we disable generating wrappers for `type data` constructors altogether. Fixes #24620. Co-authored-by:
Ryan Scott <ryan.gl.scott@gmail.com> (cherry picked from commit 5e4f4ba8)
-
(cherry picked from commit e5687186)
-
Just for debugging, no effect on normal code (cherry picked from commit 58408c77)
-
This small patch fixes #24726, by tracking in-scope variables properly in -drule-check. Not hard to do! (cherry picked from commit be1e60ee)
-
(cherry picked from commit bc672166)
-
- Sep 29, 2024
-
-
Sylvain Henry authored
(cherry picked from commit daeda834)
-
Ryan Scott authored
We need to ensure that the output of `cvtp` is parenthesized (at precedence `sigPrec`) so that any pattern signatures with a surrounding pattern signature can parse correctly. Fixes #24837. (cherry picked from commit a3cd3a1d)
-
Andreas Klebinger authored
When evaluating PUSH_G try to tag the reference we are pushing if it's a constructor. This is potentially helpful for performance and required to fix #24870. (cherry picked from commit 1bfa9111)
-