summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2022-01-29 23:45:13 -0500
committerMarge Bot <ben+marge-bot@smart-cactus.org>2022-02-04 16:14:47 -0500
commit1cf9616a379a084daaa4d7219ebb75aa3e358e05 (patch)
treeb2dfbda1609161977e045d1d9b2ae834b33ea634
parent606b59a55c543607742092897bb774f7cb88e65d (diff)
downloadhaskell-1cf9616a379a084daaa4d7219ebb75aa3e358e05.tar.gz
llvmGen: Handle unaligned loads/stores
This allows us to produce valid code for indexWord8ArrayAs*# on platforms that lack unaligned memory access.
-rw-r--r--compiler/GHC/CmmToLlvm/CodeGen.hs14
1 files changed, 7 insertions, 7 deletions
diff --git a/compiler/GHC/CmmToLlvm/CodeGen.hs b/compiler/GHC/CmmToLlvm/CodeGen.hs
index 08b1478331..3b7ca1ebbe 100644
--- a/compiler/GHC/CmmToLlvm/CodeGen.hs
+++ b/compiler/GHC/CmmToLlvm/CodeGen.hs
@@ -1213,10 +1213,10 @@ mkStore :: LlvmVar -> LlvmVar -> AlignmentSpec -> LlvmStatement
mkStore vval vptr alignment =
Store vval vptr align
where
- is_vector = isVector (pLower (getVarType vptr))
+ ty = pLower (getVarType vptr)
align = case alignment of
-- See Note [Alignment of vector-typed values]
- _ | is_vector -> Just 1
+ _ | isVector ty -> Just 1
Unaligned -> Just 1
NaturallyAligned -> Nothing
@@ -1900,14 +1900,14 @@ case we will need a more granular way of specifying alignment.
-}
mkLoad :: Atomic -> LlvmVar -> AlignmentSpec -> LlvmExpression
-mkLoad atomic ptr alignment
- | atomic = ALoad SyncSeqCst False ptr
- | otherwise = Load ptr align
+mkLoad atomic vptr alignment
+ | atomic = ALoad SyncSeqCst False vptr
+ | otherwise = Load vptr align
where
- ty = pLower (getVarType ptr)
+ ty = pLower (getVarType vptr)
align = case alignment of
-- See Note [Alignment of vector-typed values]
- _ | is_vector -> Just 1
+ _ | isVector ty -> Just 1
Unaligned -> Just 1
NaturallyAligned -> Nothing