[Git][ghc/ghc][master] compiler: emit NaturallyAligned when element type & index type are the same width

Marge Bot (@marge-bot) gitlab at gitlab.haskell.org
Mon Jun 3 23:44:50 UTC 2024



Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC


Commits:
0cff083a by Cheng Shao at 2024-06-03T19:43:58-04:00
compiler: emit NaturallyAligned when element type & index type are the same width

This commit fixes a subtle mistake in alignmentFromTypes that used to
generate Unaligned when element type & index type are the same width.
Fixes #24930.

- - - - -


1 changed file:

- compiler/GHC/StgToCmm/Prim.hs


Changes:

=====================================
compiler/GHC/StgToCmm/Prim.hs
=====================================
@@ -2302,8 +2302,8 @@ alignmentFromTypes :: CmmType  -- ^ element type
                    -> CmmType  -- ^ index type
                    -> AlignmentSpec
 alignmentFromTypes ty idx_ty
-  | typeWidth ty < typeWidth idx_ty = NaturallyAligned
-  | otherwise                       = Unaligned
+  | typeWidth ty <= typeWidth idx_ty = NaturallyAligned
+  | otherwise                        = Unaligned
 
 doIndexOffAddrOp :: Maybe MachOp
                  -> CmmType



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/0cff083abb24701530974872b21cf897c9955a9a

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/0cff083abb24701530974872b21cf897c9955a9a
You're receiving this email because of your account on gitlab.haskell.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20240603/55f52818/attachment.html>


More information about the ghc-commits mailing list