summaryrefslogtreecommitdiff
path: root/testsuite/tests
diff options
context:
space:
mode:
authorSimon Peyton Jones <simonpj@microsoft.com>2022-07-07 14:21:41 +0100
committerSimon Peyton Jones <simonpj@microsoft.com>2022-08-25 08:38:16 +0100
commita90298cc7291677fddd9e374e222676306265c17 (patch)
tree8db696c8599547a2775eec15108d49304744f58f /testsuite/tests
parenta9f0e68ede36ad571d32e66a8e49e8c9f3b6a92b (diff)
downloadhaskell-a90298cc7291677fddd9e374e222676306265c17.tar.gz
Fix arityType: -fpedantic-bottoms, join points, etcwip/T21694a
This MR fixes #21694, #21755. It also makes sure that #21948 and fix to #21694. * For #21694 the underlying problem was that we were calling arityType on an expression that had free join points. This is a Bad Bad Idea. See Note [No free join points in arityType]. * To make "no free join points in arityType" work out I had to avoid trying to use eta-expansion for runRW#. This entailed a few changes in the Simplifier's treatment of runRW#. See GHC.Core.Opt.Simplify.Iteration Note [No eta-expansion in runRW#] * I also made andArityType work correctly with -fpedantic-bottoms; see Note [Combining case branches: andWithTail]. * Rewrote Note [Combining case branches: optimistic one-shot-ness] * arityType previously treated join points differently to other let-bindings. This patch makes them unform; arityType analyses the RHS of all bindings to get its ArityType, and extends am_sigs. I realised that, now we have am_sigs giving the ArityType for let-bound Ids, we don't need the (pre-dating) special code in arityType for join points. But instead we need to extend the env for Rec bindings, which weren't doing before. More uniform now. See Note [arityType for let-bindings]. This meant we could get rid of ae_joins, and in fact get rid of EtaExpandArity altogether. Simpler. * And finally, it was the strange treatment of join-point Ids in arityType (involving a fake ABot type) that led to a serious bug: #21755. Fixed by this refactoring, which treats them uniformly; but without breaking #18328. In fact, the arity for recursive join bindings is pretty tricky; see the long Note [Arity for recursive join bindings] in GHC.Core.Opt.Simplify.Utils. That led to more refactoring, including deciding that an Id could have an Arity that is bigger than its JoinArity; see Note [Invariants on join points], item 2(b) in GHC.Core * Make sure that the "demand threshold" for join points in DmdAnal is no bigger than the join-arity. In GHC.Core.Opt.DmdAnal see Note [Demand signatures are computed for a threshold arity based on idArity] * I moved GHC.Core.Utils.exprIsDeadEnd into GHC.Core.Opt.Arity, where it more properly belongs. * Remove an old, redundant hack in FloatOut. The old Note was Note [Bottoming floats: eta expansion] in GHC.Core.Opt.SetLevels. Compile time improves very slightly on average: Metrics: compile_time/bytes allocated --------------------------------------------------------------------------------------- T18223(normal) ghc/alloc 725,808,720 747,839,216 +3.0% BAD T6048(optasm) ghc/alloc 105,006,104 101,599,472 -3.2% GOOD geo. mean -0.2% minimum -3.2% maximum +3.0% For some reason Windows was better T10421(normal) ghc/alloc 125,888,360 124,129,168 -1.4% GOOD T18140(normal) ghc/alloc 85,974,520 83,884,224 -2.4% GOOD T18698b(normal) ghc/alloc 236,764,568 234,077,288 -1.1% GOOD T18923(normal) ghc/alloc 75,660,528 73,994,512 -2.2% GOOD T6048(optasm) ghc/alloc 112,232,512 108,182,520 -3.6% GOOD geo. mean -0.6% I had a quick look at T18223 but it is knee deep in coercions and the size of everything looks similar before and after. I decided to accept that 3% increase in exchange for goodness elsewhere. Metric Decrease: T10421 T18140 T18698b T18923 T6048 Metric Increase: T18223
Diffstat (limited to 'testsuite/tests')
-rw-r--r--testsuite/tests/arityanal/should_compile/T21755.hs11
-rw-r--r--testsuite/tests/arityanal/should_compile/T21755.stderr1
-rw-r--r--testsuite/tests/arityanal/should_compile/all.T1
-rw-r--r--testsuite/tests/arityanal/should_run/T21694a.hs27
-rw-r--r--testsuite/tests/arityanal/should_run/T21694a.stderr3
-rw-r--r--testsuite/tests/arityanal/should_run/all.T4
-rw-r--r--testsuite/tests/simplCore/should_compile/T21694.hs91
-rw-r--r--testsuite/tests/simplCore/should_compile/T21694b.hs6
-rw-r--r--testsuite/tests/simplCore/should_compile/T21694b.stderr115
-rw-r--r--testsuite/tests/simplCore/should_compile/T21948.hs10
-rw-r--r--testsuite/tests/simplCore/should_compile/T21948.stderr181
-rw-r--r--testsuite/tests/simplCore/should_compile/T21960.hs102
-rw-r--r--testsuite/tests/simplCore/should_compile/T21960.stderr2095
-rw-r--r--testsuite/tests/simplCore/should_compile/all.T4
14 files changed, 2651 insertions, 0 deletions
diff --git a/testsuite/tests/arityanal/should_compile/T21755.hs b/testsuite/tests/arityanal/should_compile/T21755.hs
new file mode 100644
index 0000000000..c21557125c
--- /dev/null
+++ b/testsuite/tests/arityanal/should_compile/T21755.hs
@@ -0,0 +1,11 @@
+module T21755 where
+
+mySum :: [Int] -> Int
+mySum [] = 0
+mySum (x:xs) = x + mySum xs
+
+f :: Int -> (Int -> Int) -> Int -> Int
+f k z =
+ if even (mySum [0..k])
+ then \n -> n + 1
+ else \n -> z n
diff --git a/testsuite/tests/arityanal/should_compile/T21755.stderr b/testsuite/tests/arityanal/should_compile/T21755.stderr
new file mode 100644
index 0000000000..0519ecba6e
--- /dev/null
+++ b/testsuite/tests/arityanal/should_compile/T21755.stderr
@@ -0,0 +1 @@
+ \ No newline at end of file
diff --git a/testsuite/tests/arityanal/should_compile/all.T b/testsuite/tests/arityanal/should_compile/all.T
index cb962dd32a..6124bf12c9 100644
--- a/testsuite/tests/arityanal/should_compile/all.T
+++ b/testsuite/tests/arityanal/should_compile/all.T
@@ -21,3 +21,4 @@ test('Arity16', [ only_ways(['optasm']), grep_errmsg('Arity=') ], compile, ['-dn
test('T18793', [ only_ways(['optasm']), grep_errmsg('Arity=') ], compile, ['-dno-typeable-binds -ddump-simpl -dppr-cols=99999 -dsuppress-uniques'])
test('T18870', [ only_ways(['optasm']) ], compile, ['-ddebug-output'])
test('T18937', [ only_ways(['optasm']) ], compile, ['-ddebug-output'])
+test('T21755', [ grep_errmsg(r'Arity=') ], compile, ['-O -dno-typeable-binds -fno-worker-wrapper'])
diff --git a/testsuite/tests/arityanal/should_run/T21694a.hs b/testsuite/tests/arityanal/should_run/T21694a.hs
new file mode 100644
index 0000000000..ca01c1cb92
--- /dev/null
+++ b/testsuite/tests/arityanal/should_run/T21694a.hs
@@ -0,0 +1,27 @@
+module Main (main) where
+
+import GHC.Exts
+import Control.DeepSeq
+import System.Exit
+
+-- If we eta expand the `False` branch will return
+-- a lambda \eta -> z instead of z.
+-- This behaves differently if the z argument is a bottom.
+-- We used to assume that a oneshot annotation would mean
+-- we could eta-expand on *all* branches. But this is clearly
+-- not sound in this case. So we test for this here.
+{-# NOINLINE f #-}
+f :: Bool -> (Int -> Int) -> Int -> Int
+f b z =
+ case b of
+ True -> oneShot $ \n -> n + 1
+ False -> z
+
+
+
+main :: IO Int
+main = do
+ return $! force $! f False (error "Urkh! But expected!")
+ return 0
+
+
diff --git a/testsuite/tests/arityanal/should_run/T21694a.stderr b/testsuite/tests/arityanal/should_run/T21694a.stderr
new file mode 100644
index 0000000000..8a0fd0cc91
--- /dev/null
+++ b/testsuite/tests/arityanal/should_run/T21694a.stderr
@@ -0,0 +1,3 @@
+T21694a: Urkh! But expected!
+CallStack (from HasCallStack):
+ error, called at T21694a.hs:23:33 in main:Main
diff --git a/testsuite/tests/arityanal/should_run/all.T b/testsuite/tests/arityanal/should_run/all.T
index a6b06fbb15..c808036854 100644
--- a/testsuite/tests/arityanal/should_run/all.T
+++ b/testsuite/tests/arityanal/should_run/all.T
@@ -1,2 +1,6 @@
+# "Unit tests"
+
# Regression tests
test('T21652', [ only_ways(['optasm']) ], compile_and_run, [''])
+test('T21694a', [ only_ways(['optasm']), exit_code(1) ], compile_and_run, ['-fpedantic-bottoms'])
+
diff --git a/testsuite/tests/simplCore/should_compile/T21694.hs b/testsuite/tests/simplCore/should_compile/T21694.hs
new file mode 100644
index 0000000000..98c5a55c59
--- /dev/null
+++ b/testsuite/tests/simplCore/should_compile/T21694.hs
@@ -0,0 +1,91 @@
+{-# LANGUAGE BangPatterns #-}
+{-# LANGUAGE CPP #-}
+{-# LANGUAGE MagicHash #-}
+{-# OPTIONS_GHC -Wall #-}
+module Bug (go_fast_end) where
+
+import Control.Monad.ST (ST)
+import qualified Data.ByteString.Internal as BS
+import qualified Data.ByteString.Unsafe as BS
+import Data.ByteString (ByteString)
+import Foreign.ForeignPtr (withForeignPtr)
+import Foreign.Ptr (plusPtr)
+import GHC.Exts ( Int(..), Int#, Ptr(..), Word(..)
+ , (<#), (>#), indexWord64OffAddr#, isTrue#, orI#
+ )
+import GHC.Word (Word8(..), Word64(..))
+import System.IO.Unsafe (unsafeDupablePerformIO)
+
+#if MIN_VERSION_ghc_prim(0,8,0)
+import GHC.Exts (word8ToWord#)
+#endif
+
+#if __GLASGOW_HASKELL__ >= 904
+import GHC.Exts (byteSwap64#, int64ToInt#, word64ToInt64#, ltWord64#, wordToWord64#)
+#else
+import GHC.Exts (byteSwap#, ltWord#, word2Int#)
+#endif
+
+go_fast_end :: ByteString -> DecodeAction s a -> ST s (SlowPath s a)
+go_fast_end !bs (ConsumeInt32 k) =
+ case tryConsumeInt (BS.unsafeHead bs) bs of
+ DecodeFailure -> return $! SlowFail bs "expected int32"
+ DecodedToken sz (I# n#) ->
+ case (n# ># 0x7fffffff#) `orI#` (n# <# -0x80000000#) of
+ 0# -> k n# >>= go_fast_end (BS.unsafeDrop sz bs)
+ _ -> return $! SlowFail bs "expected int32"
+
+data SlowPath s a = SlowFail {-# UNPACK #-} !ByteString String
+
+data DecodeAction s a = ConsumeInt32 (Int# -> ST s (DecodeAction s a))
+
+data DecodedToken a = DecodedToken !Int !a | DecodeFailure
+
+tryConsumeInt :: Word8 -> ByteString -> DecodedToken Int
+tryConsumeInt hdr !bs = case word8ToWord hdr of
+ 0x17 -> DecodedToken 1 23
+ 0x1b -> case word64ToInt (eatTailWord64 bs) of
+ Just n -> DecodedToken 9 n
+ Nothing -> DecodeFailure
+ _ -> DecodeFailure
+{-# INLINE tryConsumeInt #-}
+
+eatTailWord64 :: ByteString -> Word64
+eatTailWord64 xs = withBsPtr grabWord64 (BS.unsafeTail xs)
+{-# INLINE eatTailWord64 #-}
+
+word64ToInt :: Word64 -> Maybe Int
+#if __GLASGOW_HASKELL__ >= 904
+word64ToInt (W64# w#) =
+ case isTrue# (w# `ltWord64#` wordToWord64# 0x80000000##) of
+ True -> Just (I# (int64ToInt# (word64ToInt64# w#)))
+ False -> Nothing
+#else
+word64ToInt (W64# w#) =
+ case isTrue# (w# `ltWord#` 0x8000000000000000##) of
+ True -> Just (I# (word2Int# w#))
+ False -> Nothing
+#endif
+{-# INLINE word64ToInt #-}
+
+withBsPtr :: (Ptr b -> a) -> ByteString -> a
+withBsPtr f (BS.PS x off _) =
+ unsafeDupablePerformIO $ withForeignPtr x $
+ \(Ptr addr#) -> return $! (f (Ptr addr# `plusPtr` off))
+{-# INLINE withBsPtr #-}
+
+grabWord64 :: Ptr () -> Word64
+#if __GLASGOW_HASKELL__ >= 904
+grabWord64 (Ptr ip#) = W64# (byteSwap64# (indexWord64OffAddr# ip# 0#))
+#else
+grabWord64 (Ptr ip#) = W64# (byteSwap# (indexWord64OffAddr# ip# 0#))
+#endif
+{-# INLINE grabWord64 #-}
+
+word8ToWord :: Word8 -> Word
+#if MIN_VERSION_ghc_prim(0,8,0)
+word8ToWord (W8# w#) = W# (word8ToWord# w#)
+#else
+word8ToWord (W8# w#) = W# w#
+#endif
+{-# INLINE word8ToWord #-}
diff --git a/testsuite/tests/simplCore/should_compile/T21694b.hs b/testsuite/tests/simplCore/should_compile/T21694b.hs
new file mode 100644
index 0000000000..68f2bef2df
--- /dev/null
+++ b/testsuite/tests/simplCore/should_compile/T21694b.hs
@@ -0,0 +1,6 @@
+module T21694 where
+
+-- f should get arity 4
+f x = let j 0 = \ a b c -> (a,x,b)
+ j n = j (n-1 :: Int)
+ in j 20
diff --git a/testsuite/tests/simplCore/should_compile/T21694b.stderr b/testsuite/tests/simplCore/should_compile/T21694b.stderr
new file mode 100644
index 0000000000..2cd41cb17f
--- /dev/null
+++ b/testsuite/tests/simplCore/should_compile/T21694b.stderr
@@ -0,0 +1,115 @@
+
+==================== Tidy Core ====================
+Result size of Tidy Core
+ = {terms: 44, types: 40, coercions: 0, joins: 2/2}
+
+-- RHS size: {terms: 2, types: 0, coercions: 0, joins: 0/0}
+T21694.f1 :: Int
+[GblId,
+ Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True,
+ WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 10 10}]
+T21694.f1 = GHC.Types.I# 20#
+
+-- RHS size: {terms: 26, types: 22, coercions: 0, joins: 2/2}
+f :: forall {p1} {a} {c} {p2}. p1 -> a -> c -> p2 -> (a, p1, c)
+[GblId,
+ Arity=4,
+ Str=<L><L><L><A>,
+ Cpr=1,
+ Unf=Unf{Src=InlineStable, TopLvl=True, Value=True, ConLike=True,
+ WorkFree=True, Expandable=True,
+ Guidance=ALWAYS_IF(arity=4,unsat_ok=True,boring_ok=False)
+ Tmpl= \ (@p_ax8)
+ (@a_aL5)
+ (@c_aL6)
+ (@p1_aL7)
+ (x_agu [Occ=OnceL1] :: p_ax8)
+ (eta_B0 [Occ=OnceL1] :: a_aL5)
+ (eta1_B1 [Occ=OnceL1] :: c_aL6)
+ _ [Occ=Dead] ->
+ joinrec {
+ j_sLX [InlPrag=[2], Occ=T[1]] :: Int -> (a_aL5, p_ax8, c_aL6)
+ [LclId[JoinId(1)(Just [!])],
+ Arity=1,
+ Str=<S!P(SL)>,
+ Unf=Unf{Src=InlineStable, TopLvl=False, Value=True, ConLike=True,
+ WorkFree=True, Expandable=True,
+ Guidance=ALWAYS_IF(arity=1,unsat_ok=True,boring_ok=False)
+ Tmpl= \ (ds_sM1 [Occ=Once1!] :: Int) ->
+ case ds_sM1 of { GHC.Types.I# ww_sM3 [Occ=Once1] ->
+ jump $wj_sM6 ww_sM3
+ }}]
+ j_sLX (ds_sM1 [Occ=Once1!] :: Int)
+ = case ds_sM1 of { GHC.Types.I# ww_sM3 [Occ=Once1] ->
+ jump $wj_sM6 ww_sM3
+ };
+ $wj_sM6 [InlPrag=[2], Occ=LoopBreakerT[1]]
+ :: GHC.Prim.Int# -> (a_aL5, p_ax8, c_aL6)
+ [LclId[JoinId(1)(Nothing)], Arity=1, Str=<SL>, Unf=OtherCon []]
+ $wj_sM6 (ww_sM3 [Occ=Once1!] :: GHC.Prim.Int#)
+ = case ww_sM3 of ds_X2 [Occ=Once1] {
+ __DEFAULT -> jump j_sLX (GHC.Types.I# (GHC.Prim.-# ds_X2 1#));
+ 0# -> (eta_B0, x_agu, eta1_B1)
+ }; } in
+ jump j_sLX T21694.f1}]
+f = \ (@p_ax8)
+ (@a_aL5)
+ (@c_aL6)
+ (@p1_aL7)
+ (x_agu :: p_ax8)
+ (eta_B0 :: a_aL5)
+ (eta1_B1 :: c_aL6)
+ _ [Occ=Dead] ->
+ join {
+ exit_X3 [Dmd=S!P(L,L,L)] :: (a_aL5, p_ax8, c_aL6)
+ [LclId[JoinId(0)(Nothing)]]
+ exit_X3 = (eta_B0, x_agu, eta1_B1) } in
+ joinrec {
+ $wj_sM6 [InlPrag=[2], Occ=LoopBreaker, Dmd=SCS(!P(L,L,L))]
+ :: GHC.Prim.Int# -> (a_aL5, p_ax8, c_aL6)
+ [LclId[JoinId(1)(Nothing)], Arity=1, Str=<1L>, Unf=OtherCon []]
+ $wj_sM6 (ww_sM3 :: GHC.Prim.Int#)
+ = case ww_sM3 of ds_X2 {
+ __DEFAULT -> jump $wj_sM6 (GHC.Prim.-# ds_X2 1#);
+ 0# -> jump exit_X3
+ }; } in
+ jump $wj_sM6 20#
+
+-- RHS size: {terms: 1, types: 0, coercions: 0, joins: 0/0}
+T21694.$trModule4 :: GHC.Prim.Addr#
+[GblId,
+ Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True,
+ WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 20 0}]
+T21694.$trModule4 = "main"#
+
+-- RHS size: {terms: 2, types: 0, coercions: 0, joins: 0/0}
+T21694.$trModule3 :: GHC.Types.TrName
+[GblId,
+ Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True,
+ WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 10 10}]
+T21694.$trModule3 = GHC.Types.TrNameS T21694.$trModule4
+
+-- RHS size: {terms: 1, types: 0, coercions: 0, joins: 0/0}
+T21694.$trModule2 :: GHC.Prim.Addr#
+[GblId,
+ Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True,
+ WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 30 0}]
+T21694.$trModule2 = "T21694"#
+
+-- RHS size: {terms: 2, types: 0, coercions: 0, joins: 0/0}
+T21694.$trModule1 :: GHC.Types.TrName
+[GblId,
+ Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True,
+ WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 10 10}]
+T21694.$trModule1 = GHC.Types.TrNameS T21694.$trModule2
+
+-- RHS size: {terms: 3, types: 0, coercions: 0, joins: 0/0}
+T21694.$trModule :: GHC.Types.Module
+[GblId,
+ Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True,
+ WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 10 10}]
+T21694.$trModule
+ = GHC.Types.Module T21694.$trModule3 T21694.$trModule1
+
+
+
diff --git a/testsuite/tests/simplCore/should_compile/T21948.hs b/testsuite/tests/simplCore/should_compile/T21948.hs
new file mode 100644
index 0000000000..5354bd0020
--- /dev/null
+++ b/testsuite/tests/simplCore/should_compile/T21948.hs
@@ -0,0 +1,10 @@
+module T21948 where
+
+import GHC.Int( Int64 )
+
+nf' :: (b -> ()) -> (a -> b) -> a -> (Int64 -> IO ())
+nf' reduce f x = go
+ where
+ go n | n <= 0 = return ()
+ | otherwise = let !y = f x
+ in reduce y `seq` go (n-1)
diff --git a/testsuite/tests/simplCore/should_compile/T21948.stderr b/testsuite/tests/simplCore/should_compile/T21948.stderr
new file mode 100644
index 0000000000..4f68cc5884
--- /dev/null
+++ b/testsuite/tests/simplCore/should_compile/T21948.stderr
@@ -0,0 +1,181 @@
+
+==================== Tidy Core ====================
+Result size of Tidy Core
+ = {terms: 59, types: 65, coercions: 25, joins: 1/3}
+
+-- RHS size: {terms: 42, types: 34, coercions: 0, joins: 1/3}
+T21948.nf'1
+ :: forall {b} {a}.
+ (b -> ())
+ -> (a -> b)
+ -> a
+ -> Int64
+ -> GHC.Prim.State# GHC.Prim.RealWorld
+ -> (# GHC.Prim.State# GHC.Prim.RealWorld, () #)
+[GblId,
+ Arity=5,
+ Str=<MC1(A)><MC1(L)><L><1!P(L)><L>,
+ Cpr=1(, 1),
+ Unf=Unf{Src=InlineStable, TopLvl=True, Value=True, ConLike=True,
+ WorkFree=True, Expandable=True,
+ Guidance=ALWAYS_IF(arity=5,unsat_ok=True,boring_ok=False)
+ Tmpl= \ (@b_aY7)
+ (@a_aY8)
+ (reduce_aBy [Occ=OnceL1!] :: b_aY7 -> ())
+ (f_aBz [Occ=Once1!] :: a_aY8 -> b_aY7)
+ (x_aBA [Occ=Once1] :: a_aY8)
+ (eta_B0 [Occ=Once1] :: Int64)
+ (eta1_B1 [Occ=Once1, OS=OneShot]
+ :: GHC.Prim.State# GHC.Prim.RealWorld) ->
+ let {
+ lvl_s111 [Occ=OnceL1] :: b_aY7
+ [LclId]
+ lvl_s111 = f_aBz x_aBA } in
+ joinrec {
+ go_s10Z [InlPrag=[2], Occ=T[2]]
+ :: Int64
+ -> GHC.Prim.State# GHC.Prim.RealWorld
+ -> (# GHC.Prim.State# GHC.Prim.RealWorld, () #)
+ [LclId[JoinId(2)(Just [!])],
+ Arity=2,
+ Str=<S!P(L)><L>,
+ Unf=Unf{Src=InlineStable, TopLvl=False, Value=True, ConLike=True,
+ WorkFree=True, Expandable=True,
+ Guidance=ALWAYS_IF(arity=2,unsat_ok=True,boring_ok=False)
+ Tmpl= \ (n_s11c [Occ=Once1!] :: Int64)
+ (eta2_s11g [Occ=Once1, OS=OneShot]
+ :: GHC.Prim.State# GHC.Prim.RealWorld) ->
+ case n_s11c of { GHC.Int.I64# ww_s11e [Occ=Once1] ->
+ jump $wgo_s11i ww_s11e eta2_s11g
+ }}]
+ go_s10Z (n_s11c [Occ=Once1!] :: Int64)
+ (eta2_s11g [Occ=Once1, OS=OneShot]
+ :: GHC.Prim.State# GHC.Prim.RealWorld)
+ = case n_s11c of { GHC.Int.I64# ww_s11e [Occ=Once1] ->
+ jump $wgo_s11i ww_s11e eta2_s11g
+ };
+ $wgo_s11i [InlPrag=[2], Occ=LoopBreakerT[2]]
+ :: GHC.Prim.Int64#
+ -> GHC.Prim.State# GHC.Prim.RealWorld
+ -> (# GHC.Prim.State# GHC.Prim.RealWorld, () #)
+ [LclId[JoinId(2)(Nothing)], Arity=2, Str=<L><L>, Unf=OtherCon []]
+ $wgo_s11i (ww_s11e :: GHC.Prim.Int64#)
+ (eta2_s11g [Occ=Once2, OS=OneShot]
+ :: GHC.Prim.State# GHC.Prim.RealWorld)
+ = case GHC.Prim.leInt64# ww_s11e 0#64 of {
+ __DEFAULT ->
+ case lvl_s111 of y_aNQ [Occ=Once1] { __DEFAULT ->
+ case reduce_aBy y_aNQ of { () ->
+ jump go_s10Z
+ (GHC.Int.I64# (GHC.Prim.subInt64# ww_s11e 1#64)) eta2_s11g
+ }
+ };
+ 1# -> (# eta2_s11g, GHC.Tuple.() #)
+ }; } in
+ jump go_s10Z eta_B0 eta1_B1}]
+T21948.nf'1
+ = \ (@b_aY7)
+ (@a_aY8)
+ (reduce_aBy :: b_aY7 -> ())
+ (f_aBz [OS=OneShot] :: a_aY8 -> b_aY7)
+ (x_aBA [OS=OneShot] :: a_aY8)
+ (eta_B0 [OS=OneShot] :: Int64)
+ (eta1_B1 [OS=OneShot] :: GHC.Prim.State# GHC.Prim.RealWorld) ->
+ case eta_B0 of { GHC.Int.I64# ww_s11e ->
+ let {
+ lvl_s111 :: b_aY7
+ [LclId]
+ lvl_s111 = f_aBz x_aBA } in
+ let {
+ lvl1_s11A [Dmd=LA] :: ()
+ [LclId]
+ lvl1_s11A = reduce_aBy lvl_s111 } in
+ joinrec {
+ $wgo_s11i [InlPrag=[2], Occ=LoopBreaker, Dmd=SCS(C1(!P(L,L)))]
+ :: GHC.Prim.Int64#
+ -> GHC.Prim.State# GHC.Prim.RealWorld
+ -> (# GHC.Prim.State# GHC.Prim.RealWorld, () #)
+ [LclId[JoinId(2)(Nothing)], Arity=2, Str=<L><L>, Unf=OtherCon []]
+ $wgo_s11i (ww1_X3 :: GHC.Prim.Int64#)
+ (eta2_s11g [OS=OneShot] :: GHC.Prim.State# GHC.Prim.RealWorld)
+ = case GHC.Prim.leInt64# ww1_X3 0#64 of {
+ __DEFAULT ->
+ case lvl_s111 of { __DEFAULT ->
+ case lvl1_s11A of { () ->
+ jump $wgo_s11i (GHC.Prim.subInt64# ww1_X3 1#64) eta2_s11g
+ }
+ };
+ 1# -> (# eta2_s11g, GHC.Tuple.() #)
+ }; } in
+ jump $wgo_s11i ww_s11e eta1_B1
+ }
+
+-- RHS size: {terms: 1, types: 0, coercions: 25, joins: 0/0}
+nf' :: forall b a. (b -> ()) -> (a -> b) -> a -> Int64 -> IO ()
+[GblId,
+ Arity=5,
+ Str=<MC1(A)><MC1(L)><L><1!P(L)><L>,
+ Cpr=1(, 1),
+ Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True,
+ WorkFree=True, Expandable=True,
+ Guidance=ALWAYS_IF(arity=0,unsat_ok=True,boring_ok=True)}]
+nf'
+ = T21948.nf'1
+ `cast` (forall (b :: <*>_N) (a :: <*>_N).
+ <(b |> <*>_N) -> ()>_R
+ %<'Many>_N ->_R <(a |> <*>_N) -> (b |> <*>_N)>_R
+ %<'Many>_N ->_R <(a |> <*>_N)>_R
+ %<'Many>_N ->_R <Int64>_R
+ %<'Many>_N ->_R Sym (GHC.Types.N:IO[0] <()>_R)
+ :: (forall {b} {a}.
+ ((b |> <*>_N) -> ())
+ -> ((a |> <*>_N) -> (b |> <*>_N))
+ -> (a |> <*>_N)
+ -> Int64
+ -> GHC.Prim.State# GHC.Prim.RealWorld
+ -> (# GHC.Prim.State# GHC.Prim.RealWorld, () #))
+ ~R# (forall {b} {a}.
+ ((b |> <*>_N) -> ())
+ -> ((a |> <*>_N) -> (b |> <*>_N))
+ -> (a |> <*>_N)
+ -> Int64
+ -> IO ()))
+
+-- RHS size: {terms: 1, types: 0, coercions: 0, joins: 0/0}
+T21948.$trModule4 :: GHC.Prim.Addr#
+[GblId,
+ Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True,
+ WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 20 0}]
+T21948.$trModule4 = "main"#
+
+-- RHS size: {terms: 2, types: 0, coercions: 0, joins: 0/0}
+T21948.$trModule3 :: GHC.Types.TrName
+[GblId,
+ Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True,
+ WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 10 10}]
+T21948.$trModule3 = GHC.Types.TrNameS T21948.$trModule4
+
+-- RHS size: {terms: 1, types: 0, coercions: 0, joins: 0/0}
+T21948.$trModule2 :: GHC.Prim.Addr#
+[GblId,
+ Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True,
+ WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 30 0}]
+T21948.$trModule2 = "T21948"#
+
+-- RHS size: {terms: 2, types: 0, coercions: 0, joins: 0/0}
+T21948.$trModule1 :: GHC.Types.TrName
+[GblId,
+ Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True,
+ WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 10 10}]
+T21948.$trModule1 = GHC.Types.TrNameS T21948.$trModule2
+
+-- RHS size: {terms: 3, types: 0, coercions: 0, joins: 0/0}
+T21948.$trModule :: GHC.Types.Module
+[GblId,
+ Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True,
+ WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 10 10}]
+T21948.$trModule
+ = GHC.Types.Module T21948.$trModule3 T21948.$trModule1
+
+
+
diff --git a/testsuite/tests/simplCore/should_compile/T21960.hs b/testsuite/tests/simplCore/should_compile/T21960.hs
new file mode 100644
index 0000000000..d014a968e9
--- /dev/null
+++ b/testsuite/tests/simplCore/should_compile/T21960.hs
@@ -0,0 +1,102 @@
+{-# LANGUAGE BangPatterns, CPP, GeneralizedNewtypeDeriving, MagicHash,
+ UnliftedFFITypes #-}
+{-# LANGUAGE Trustworthy #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE ScopedTypeVariables #-}
+{-# LANGUAGE ViewPatterns #-}
+-- |
+-- Module : Data.Text.Encoding
+-- Copyright : (c) 2009, 2010, 2011 Bryan O'Sullivan,
+-- (c) 2009 Duncan Coutts,
+-- (c) 2008, 2009 Tom Harper
+-- (c) 2021 Andrew Lelechenko
+--
+-- License : BSD-style
+-- Maintainer : bos@serpentine.com
+-- Portability : portable
+--
+-- Functions for converting 'Text' values to and from 'ByteString',
+-- using several standard encodings.
+--
+-- To gain access to a much larger family of encodings, use the
+-- <http://hackage.haskell.org/package/text-icu text-icu package>.
+
+module Data.Text.Encoding
+ (
+ encodeUtf8BuilderEscaped
+ ) where
+
+import Control.Monad.ST.Unsafe (unsafeIOToST, unsafeSTToIO)
+
+import Control.Exception (evaluate, try)
+import Control.Monad.ST (runST, ST)
+import Data.Bits (shiftR, (.&.))
+import Data.ByteString (ByteString)
+import qualified Data.ByteString as B
+import qualified Data.ByteString.Internal as B
+import qualified Data.ByteString.Short.Internal as SBS
+import Data.Text.Encoding.Error (OnDecodeError, UnicodeException, strictDecode, lenientDecode)
+import Data.Text.Internal (Text(..), safe, empty, append)
+import Data.Text.Internal.Unsafe (unsafeWithForeignPtr)
+import Data.Text.Internal.Unsafe.Char (unsafeWrite)
+import Data.Text.Unsafe (unsafeDupablePerformIO)
+import Data.Word (Word8)
+import Foreign.C.Types (CSize(..))
+import Foreign.Ptr (Ptr, minusPtr, plusPtr)
+import Foreign.Storable (poke, peekByteOff)
+import GHC.Exts (byteArrayContents#, unsafeCoerce#)
+import GHC.ForeignPtr (ForeignPtr(..), ForeignPtrContents(PlainPtr))
+import qualified Data.ByteString.Builder as B
+import qualified Data.ByteString.Builder.Internal as B hiding (empty, append)
+import qualified Data.ByteString.Builder.Prim as BP
+import qualified Data.ByteString.Builder.Prim.Internal as BP
+import Data.Text.Internal.Encoding.Utf8 (utf8DecodeStart, utf8DecodeContinue, DecoderResult(..))
+import qualified Data.Text.Array as A
+import qualified Data.Text.Internal.Encoding.Fusion as E
+import qualified Data.Text.Internal.Fusion as F
+import Data.Text.Internal.ByteStringCompat
+
+
+
+-- | Encode text using UTF-8 encoding and escape the ASCII characters using
+-- a 'BP.BoundedPrim'.
+--
+-- Use this function is to implement efficient encoders for text-based formats
+-- like JSON or HTML.
+--
+-- @since 1.1.0.0
+{-# INLINE encodeUtf8BuilderEscaped #-}
+-- TODO: Extend documentation with references to source code in @blaze-html@
+-- or @aeson@ that uses this function.
+encodeUtf8BuilderEscaped :: BP.BoundedPrim Word8 -> Text -> B.Builder
+encodeUtf8BuilderEscaped be =
+ -- manual eta-expansion to ensure inlining works as expected
+ \txt -> B.builder (mkBuildstep txt)
+ where
+ bound = max 4 $ BP.sizeBound be
+
+ mkBuildstep (Text arr off len) !k =
+ outerLoop off
+ where
+ iend = off + len
+
+ outerLoop !i0 !br@(B.BufferRange op0 ope)
+ | i0 >= iend = k br
+ | outRemaining > 0 = goPartial (i0 + min outRemaining inpRemaining)
+ -- TODO: Use a loop with an integrated bound's check if outRemaining
+ -- is smaller than 8, as this will save on divisions.
+ | otherwise = return $ B.bufferFull bound op0 (outerLoop i0)
+ where
+ outRemaining = (ope `minusPtr` op0) `quot` bound
+ inpRemaining = iend - i0
+
+ goPartial !iendTmp = go i0 op0
+ where
+ go !i !op
+ | i < iendTmp = do
+ let w = A.unsafeIndex arr i
+ if w < 0x80
+ then BP.runB be w op >>= go (i + 1)
+ else poke op w >> go (i + 1) (op `plusPtr` 1)
+ | otherwise = outerLoop i (B.BufferRange op ope)
+
diff --git a/testsuite/tests/simplCore/should_compile/T21960.stderr b/testsuite/tests/simplCore/should_compile/T21960.stderr
new file mode 100644
index 0000000000..aec9866e46
--- /dev/null
+++ b/testsuite/tests/simplCore/should_compile/T21960.stderr
@@ -0,0 +1,2095 @@
+
+==================== Tidy Core ====================
+Result size of Tidy Core
+ = {terms: 1,176, types: 773, coercions: 114, joins: 25/45}
+
+-- RHS size: {terms: 1,161,
+ types: 764,
+ coercions: 114,
+ joins: 25/45}
+encodeUtf8BuilderEscaped [InlPrag=INLINE (sat-args=1)]
+ :: BP.BoundedPrim Word8 -> Text -> B.Builder
+[GblId,
+ Arity=5,
+ Str=<M!P(L,LCS(C1(C1(!P(L,1L)))))><1!P(L,L,L)><1CL(C1(L))><1L><L>,
+ Unf=Unf{Src=InlineStable, TopLvl=True, Value=True, ConLike=True,
+ WorkFree=True, Expandable=True,
+ Guidance=ALWAYS_IF(arity=1,unsat_ok=False,boring_ok=False)
+ Tmpl= (\ (be_a1kE :: BP.BoundedPrim Word8)
+ (eta_B0 [Occ=Once1!] :: Text)
+ (@r_a238)
+ (eta1_B1 [Occ=Once1] :: B.BuildStep r_a238)
+ (eta2_B2 [Occ=Once1] :: B.BufferRange)
+ (eta3_B3 [Occ=Once1, OS=OneShot]
+ :: GHC.Prim.State# GHC.Prim.RealWorld) ->
+ let {
+ bound_a1kF :: Int
+ [LclId]
+ bound_a1kF
+ = case be_a1kE of
+ { Data.ByteString.Builder.Prim.Internal.BP bx_a27M _ [Occ=Dead] ->
+ case GHC.Prim.<=# 4# bx_a27M of {
+ __DEFAULT -> GHC.Types.I# 4#;
+ 1# -> GHC.Types.I# bx_a27M
+ }
+ } } in
+ case eta_B0 of
+ { Text bx_d22M [Occ=OnceL1] bx1_d22N bx2_d22O [Occ=Once1] ->
+ case eta1_B1 of k_X2 [Occ=OnceL1!] { __DEFAULT ->
+ let {
+ iend_s26Z :: GHC.Prim.Int#
+ [LclId]
+ iend_s26Z = GHC.Prim.+# bx1_d22N bx2_d22O } in
+ let {
+ iend1_a1wD [Occ=OnceL1] :: Int
+ [LclId, Unf=OtherCon []]
+ iend1_a1wD = GHC.Types.I# iend_s26Z } in
+ letrec {
+ outerLoop_a1TC [Occ=LoopBreaker]
+ :: Int -> B.BufferRange -> IO (B.BuildSignal r_a238)
+ [LclId, Arity=3, Unf=OtherCon []]
+ outerLoop_a1TC
+ = \ (i0_a1z3 [Occ=Once1!] :: Int)
+ (br_a1z4 [Occ=Once1!] :: B.BufferRange) ->
+ case i0_a1z3 of i1_X3 { GHC.Types.I# ipv_s270 ->
+ case br_a1z4 of wild1_X4 [Occ=Once1]
+ { B.BufferRange bx3_d22P bx4_d22Q ->
+ let {
+ ope_a1z6 [Occ=OnceL1] :: Ptr Word8
+ [LclId, Unf=OtherCon []]
+ ope_a1z6 = GHC.Ptr.Ptr @Word8 bx4_d22Q } in
+ let {
+ outRemaining_a1z7 :: Int
+ [LclId]
+ outRemaining_a1z7
+ = let {
+ a_s272 :: GHC.Prim.Int#
+ [LclId]
+ a_s272 = GHC.Prim.minusAddr# bx4_d22Q bx3_d22P } in
+ case GHC.Classes.eqInt bound_a1kF (GHC.Types.I# 0#) of {
+ False ->
+ join {
+ $j_a23n [Occ=Once2T[0]] :: Int
+ [LclId[JoinId(0)(Nothing)]]
+ $j_a23n
+ = case bound_a1kF of { GHC.Types.I# y_a23P [Occ=Once1] ->
+ case GHC.Prim.quotInt# a_s272 y_a23P
+ of ds2_a23R [Occ=Once1]
+ { __DEFAULT ->
+ GHC.Types.I# ds2_a23R
+ }
+ } } in
+ case GHC.Classes.eqInt bound_a1kF (GHC.Types.I# -1#) of {
+ False -> jump $j_a23n;
+ True ->
+ case GHC.Classes.eqInt (GHC.Types.I# a_s272) GHC.Base.minInt
+ of {
+ False -> jump $j_a23n;
+ True -> GHC.Real.overflowError @Int
+ }
+ };
+ True -> GHC.Real.divZeroError @Int
+ } } in
+ case GHC.Classes.geInt i1_X3 iend1_a1wD of {
+ False ->
+ case GHC.Classes.gtInt outRemaining_a1z7 (GHC.Types.I# 0#) of {
+ False ->
+ (\ (s_a244 [Occ=Once1] :: GHC.Prim.State# GHC.Prim.RealWorld) ->
+ (# s_a244,
+ Data.ByteString.Builder.Internal.$WBufferFull
+ @r_a238
+ bound_a1kF
+ (GHC.Ptr.Ptr @Word8 bx3_d22P)
+ (outerLoop_a1TC i1_X3) #))
+ `cast` (Sym (GHC.Types.N:IO[0] <B.BuildSignal r_a238>_R)
+ :: (GHC.Prim.State# GHC.Prim.RealWorld
+ -> (# GHC.Prim.State# GHC.Prim.RealWorld,
+ B.BuildSignal r_a238 #))
+ ~R# IO (B.BuildSignal r_a238));
+ True ->
+ case outRemaining_a1z7 of { GHC.Types.I# x1_a24o ->
+ let {
+ y1_a24r :: GHC.Prim.Int#
+ [LclId]
+ y1_a24r = GHC.Prim.-# iend_s26Z ipv_s270 } in
+ join {
+ $j_s27Q [Occ=Once2!T[1]]
+ :: GHC.Prim.Int# -> IO (B.BuildSignal r_a238)
+ [LclId[JoinId(1)(Nothing)], Arity=1, Unf=OtherCon []]
+ $j_s27Q (y_a23f [Occ=Once1, OS=OneShot] :: GHC.Prim.Int#)
+ = let {
+ iendTmp_s273 [Occ=OnceL1] :: GHC.Prim.Int#
+ [LclId]
+ iendTmp_s273 = GHC.Prim.+# ipv_s270 y_a23f } in
+ let {
+ iendTmp1_X7 [Occ=OnceL1] :: Int
+ [LclId, Unf=OtherCon []]
+ iendTmp1_X7 = GHC.Types.I# iendTmp_s273 } in
+ letrec {
+ go_a1U2 [Occ=LoopBreaker]
+ :: Int -> Ptr Word8 -> IO (B.BuildSignal r_a238)
+ [LclId, Arity=3, Unf=OtherCon []]
+ go_a1U2
+ = \ (i_a1ED [Occ=Once1!] :: Int)
+ (op_a1EE [Occ=Once1!] :: Ptr Word8) ->
+ case i_a1ED of i2_X9 { GHC.Types.I# ipv1_s274 ->
+ case op_a1EE of op1_Xa [Occ=Once2]
+ { GHC.Ptr.Ptr ipv2_s276 ->
+ case GHC.Classes.ltInt i2_X9 iendTmp1_X7 of {
+ False ->
+ outerLoop_a1TC
+ i2_X9
+ (Data.ByteString.Builder.Internal.$WBufferRange
+ op1_Xa ope_a1z6);
+ True ->
+ let {
+ w_a1EF :: Word8
+ [LclId]
+ w_a1EF
+ = case GHC.Prim.indexWord8Array#
+ bx_d22M ipv1_s274
+ of r#_a24P [Occ=Once1]
+ { __DEFAULT ->
+ GHC.Word.W8# r#_a24P
+ } } in
+ case GHC.Word.ltWord8
+ w_a1EF (GHC.Word.W8# 128##8)
+ of {
+ False ->
+ (\ (s_a25B [Occ=Once1]
+ :: GHC.Prim.State#
+ GHC.Prim.RealWorld) ->
+ case w_a1EF of
+ { GHC.Word.W8# x_a26s [Occ=Once1] ->
+ case GHC.Prim.writeWord8OffAddr#
+ @GHC.Prim.RealWorld
+ ipv2_s276
+ 0#
+ x_a26s
+ s_a25B
+ of s2_a26u [Occ=Once1]
+ { __DEFAULT ->
+ ((go_a1U2
+ (GHC.Types.I#
+ (GHC.Prim.+# ipv1_s274 1#))
+ (GHC.Ptr.Ptr
+ @Word8
+ (GHC.Prim.plusAddr#
+ ipv2_s276 1#)))
+ `cast` (GHC.Types.N:IO[0]
+ <B.BuildSignal r_a238>_R
+ :: IO (B.BuildSignal r_a238)
+ ~R# (GHC.Prim.State#
+ GHC.Prim.RealWorld
+ -> (# GHC.Prim.State#
+ GHC.Prim.RealWorld,
+ B.BuildSignal
+ r_a238 #))))
+ s2_a26u
+ }
+ })
+ `cast` (Sym (GHC.Types.N:IO[0]
+ <B.BuildSignal r_a238>_R)
+ :: (GHC.Prim.State#
+ GHC.Prim.RealWorld
+ -> (# GHC.Prim.State#
+ GHC.Prim.RealWorld,
+ B.BuildSignal r_a238 #))
+ ~R# IO (B.BuildSignal r_a238));
+ True ->
+ (\ (s_a26J [Occ=Once1]
+ :: GHC.Prim.State#
+ GHC.Prim.RealWorld) ->
+ case be_a1kE of
+ { Data.ByteString.Builder.Prim.Internal.BP _ [Occ=Dead]
+ io_a26V [Occ=Once1!] ->
+ case ((io_a26V w_a1EF op1_Xa)
+ `cast` (GHC.Types.N:IO[0]
+ <Ptr Word8>_R
+ :: IO (Ptr Word8)
+ ~R# (GHC.Prim.State#
+ GHC.Prim.RealWorld
+ -> (# GHC.Prim.State#
+ GHC.Prim.RealWorld,
+ Ptr
+ Word8 #))))
+ s_a26J
+ of
+ { (# ipv3_a26L [Occ=Once1],
+ ipv4_a26M [Occ=Once1] #) ->
+ ((go_a1U2
+ (GHC.Types.I#
+ (GHC.Prim.+# ipv1_s274 1#))
+ ipv4_a26M)
+ `cast` (GHC.Types.N:IO[0]
+ <B.BuildSignal r_a238>_R
+ :: IO (B.BuildSignal r_a238)
+ ~R# (GHC.Prim.State#
+ GHC.Prim.RealWorld
+ -> (# GHC.Prim.State#
+ GHC.Prim.RealWorld,
+ B.BuildSignal
+ r_a238 #))))
+ ipv3_a26L
+ }
+ })
+ `cast` (Sym (GHC.Types.N:IO[0]
+ <B.BuildSignal r_a238>_R)
+ :: (GHC.Prim.State#
+ GHC.Prim.RealWorld
+ -> (# GHC.Prim.State#
+ GHC.Prim.RealWorld,
+ B.BuildSignal r_a238 #))
+ ~R# IO (B.BuildSignal r_a238))
+ }
+ }
+ }
+ }; } in
+ go_a1U2 i1_X3 (GHC.Ptr.Ptr @Word8 bx3_d22P) } in
+ case GHC.Prim.<=# x1_a24o y1_a24r of {
+ __DEFAULT -> jump $j_s27Q y1_a24r;
+ 1# -> jump $j_s27Q x1_a24o
+ }
+ }
+ };
+ True -> k_X2 wild1_X4
+ }
+ }
+ }; } in
+ ((outerLoop_a1TC (GHC.Types.I# bx1_d22N) eta2_B2)
+ `cast` (GHC.Types.N:IO[0] <B.BuildSignal r_a238>_R
+ :: IO (B.BuildSignal r_a238)
+ ~R# (GHC.Prim.State# GHC.Prim.RealWorld
+ -> (# GHC.Prim.State# GHC.Prim.RealWorld,
+ B.BuildSignal r_a238 #))))
+ eta3_B3
+ }
+ })
+ `cast` (<BP.BoundedPrim Word8>_R
+ %<'Many>_N ->_R <Text>_R
+ %<'Many>_N ->_R forall (r :: <*>_N).
+ <B.BuildStep (r |> <*>_N)>_R
+ %<'Many>_N ->_R <B.BufferRange>_R
+ %<'Many>_N ->_R Sym (GHC.Types.N:IO[0]
+ <B.BuildSignal (r |> <*>_N)>_R)
+ ; Sym (Data.ByteString.Builder.Internal.N:Builder[0])
+ :: (BP.BoundedPrim Word8
+ -> Text
+ -> forall {r}.
+ B.BuildStep (r |> <*>_N)
+ -> B.BufferRange
+ -> GHC.Prim.State# GHC.Prim.RealWorld
+ -> (# GHC.Prim.State# GHC.Prim.RealWorld,
+ B.BuildSignal (r |> <*>_N) #))
+ ~R# (BP.BoundedPrim Word8 -> Text -> B.Builder))}]
+encodeUtf8BuilderEscaped
+ = (\ (be_a1kE :: BP.BoundedPrim Word8)
+ (eta_B0 :: Text)
+ (@r_a238)
+ (eta1_B1 :: B.BuildStep r_a238)
+ (eta2_B2 :: B.BufferRange)
+ (eta3_B3 [OS=OneShot] :: GHC.Prim.State# GHC.Prim.RealWorld) ->
+ case eta_B0 of { Text bx_d22M bx1_d22N bx2_d22O ->
+ case eta1_B1 of k_X2 { __DEFAULT ->
+ let {
+ iend_s27f :: GHC.Prim.Int#
+ [LclId]
+ iend_s27f = GHC.Prim.+# bx1_d22N bx2_d22O } in
+ case eta2_B2 of wild1_X5 { B.BufferRange bx3_d22P bx4_d22Q ->
+ case GHC.Prim.>=# bx1_d22N iend_s27f of {
+ __DEFAULT ->
+ case be_a1kE of
+ { Data.ByteString.Builder.Prim.Internal.BP bx5_a27M ds1_a27N ->
+ join {
+ $j_s28Z [Dmd=1C1(L)]
+ :: GHC.Prim.Int#
+ -> (# GHC.Prim.State# GHC.Prim.RealWorld, B.BuildSignal r_a238 #)
+ [LclId[JoinId(1)(Nothing)], Arity=1, Str=<1L>, Unf=OtherCon []]
+ $j_s28Z (x_a27U [OS=OneShot] :: GHC.Prim.Int#)
+ = case x_a27U of wild3_X6 {
+ __DEFAULT ->
+ let {
+ a_s27n :: GHC.Prim.Int#
+ [LclId]
+ a_s27n = GHC.Prim.minusAddr# bx4_d22Q bx3_d22P } in
+ join {
+ $j1_s27p [Dmd=1!P(L,L)]
+ :: (# GHC.Prim.State# GHC.Prim.RealWorld, B.BuildSignal r_a238 #)
+ [LclId[JoinId(0)(Nothing)]]
+ $j1_s27p
+ = case GHC.Prim.quotInt# a_s27n wild3_X6 of ds2_a23R { __DEFAULT ->
+ case GHC.Prim.># ds2_a23R 0# of {
+ __DEFAULT ->
+ (# eta3_B3,
+ Data.ByteString.Builder.Internal.BufferFull
+ @r_a238
+ wild3_X6
+ bx3_d22P
+ ((\ (br_X7 :: B.BufferRange)
+ (eta4_X8 [OS=OneShot]
+ :: GHC.Prim.State# GHC.Prim.RealWorld) ->
+ letrec {
+ $s$wouterLoop_s29Y [Occ=LoopBreaker,
+ Dmd=LCS(C1(C1(C1(!P(L,L)))))]
+ :: GHC.Prim.Addr#
+ -> GHC.Prim.Addr#
+ -> GHC.Prim.Int#
+ -> GHC.Prim.State# GHC.Prim.RealWorld
+ -> (# GHC.Prim.State# GHC.Prim.RealWorld,
+ B.BuildSignal r_a238 #)
+ [LclId, Arity=4, Str=<L><L><L><L>, Unf=OtherCon []]
+ $s$wouterLoop_s29Y
+ = \ (sc_s29V :: GHC.Prim.Addr#)
+ (sc1_s29W :: GHC.Prim.Addr#)
+ (sc2_s29U :: GHC.Prim.Int#)
+ (eta5_s28W [OS=OneShot]
+ :: GHC.Prim.State# GHC.Prim.RealWorld) ->
+ case GHC.Prim.>=# sc2_s29U iend_s27f of {
+ __DEFAULT ->
+ let {
+ a1_Xe :: GHC.Prim.Int#
+ [LclId]
+ a1_Xe
+ = GHC.Prim.minusAddr# sc1_s29W sc_s29V } in
+ join {
+ $j2_Xf [Dmd=1!P(L,L)]
+ :: (# GHC.Prim.State# GHC.Prim.RealWorld,
+ B.BuildSignal r_a238 #)
+ [LclId[JoinId(0)(Nothing)]]
+ $j2_Xf
+ = case GHC.Prim.quotInt# a1_Xe wild3_X6
+ of ds4_Xg
+ { __DEFAULT ->
+ case GHC.Prim.># ds4_Xg 0# of {
+ __DEFAULT ->
+ (# eta5_s28W,
+ Data.ByteString.Builder.Internal.BufferFull
+ @r_a238
+ wild3_X6
+ sc_s29V
+ ((\ (br1_Xi :: B.BufferRange)
+ (eta6_Xj [OS=OneShot]
+ :: GHC.Prim.State#
+ GHC.Prim.RealWorld) ->
+ $wouterLoop_s28Y
+ sc2_s29U br1_Xi eta6_Xj)
+ `cast` (<B.BufferRange>_R
+ %<'Many>_N ->_R Sym (GHC.Types.N:IO[0]
+ <B.BuildSignal
+ r_a238>_R)
+ :: (B.BufferRange
+ -> GHC.Prim.State#
+ GHC.Prim.RealWorld
+ -> (# GHC.Prim.State#
+ GHC.Prim.RealWorld,
+ B.BuildSignal
+ r_a238 #))
+ ~R# (B.BufferRange
+ -> IO
+ (B.BuildSignal
+ r_a238)))) #);
+ 1# ->
+ let {
+ y1_s27t :: GHC.Prim.Int#
+ [LclId]
+ y1_s27t
+ = GHC.Prim.-#
+ iend_s27f sc2_s29U } in
+ join {
+ $j3_s27P [Dmd=1C1(!P(L,L))]
+ :: GHC.Prim.Int#
+ -> (# GHC.Prim.State#
+ GHC.Prim.RealWorld,
+ B.BuildSignal r_a238 #)
+ [LclId[JoinId(1)(Nothing)],
+ Arity=1,
+ Str=<L>,
+ Unf=OtherCon []]
+ $j3_s27P (y_a23f [OS=OneShot]
+ :: GHC.Prim.Int#)
+ = let {
+ iendTmp_s27v :: GHC.Prim.Int#
+ [LclId]
+ iendTmp_s27v
+ = GHC.Prim.+#
+ sc2_s29U y_a23f } in
+ joinrec {
+ $s$wgo_s2ai [Occ=LoopBreaker,
+ Dmd=SCS(C1(C1(!P(L,L))))]
+ :: GHC.Prim.State#
+ GHC.Prim.RealWorld
+ -> GHC.Prim.Addr#
+ -> GHC.Prim.Int#
+ -> (# GHC.Prim.State#
+ GHC.Prim.RealWorld,
+ B.BuildSignal
+ r_a238 #)
+ [LclId[JoinId(3)(Nothing)],
+ Arity=3,
+ Str=<L><L><L>,
+ Unf=OtherCon []]
+ $s$wgo_s2ai (sc3_s2ah
+ :: GHC.Prim.State#
+ GHC.Prim.RealWorld)
+ (sc4_s2ag
+ :: GHC.Prim.Addr#)
+ (sc5_s2af
+ :: GHC.Prim.Int#)
+ = case GHC.Prim.<#
+ sc5_s2af
+ iendTmp_s27v
+ of {
+ __DEFAULT ->
+ $s$wouterLoop_s29Y
+ sc4_s2ag
+ sc1_s29W
+ sc5_s2af
+ sc3_s2ah;
+ 1# ->
+ case GHC.Prim.indexWord8Array#
+ bx_d22M
+ sc5_s2af
+ of r#_a24P
+ { __DEFAULT ->
+ case GHC.Prim.ltWord8#
+ r#_a24P 128##8
+ of {
+ __DEFAULT ->
+ case GHC.Prim.writeWord8OffAddr#
+ @GHC.Prim.RealWorld
+ sc4_s2ag
+ 0#
+ r#_a24P
+ sc3_s2ah
+ of s2_a26u
+ { __DEFAULT ->
+ jump $s$wgo_s2ai
+ s2_a26u
+ (GHC.Prim.plusAddr#
+ sc4_s2ag 1#)
+ (GHC.Prim.+#
+ sc5_s2af 1#)
+ };
+ 1# ->
+ case ((ds1_a27N
+ (GHC.Word.W8#
+ r#_a24P)
+ (GHC.Ptr.Ptr
+ @Word8
+ sc4_s2ag))
+ `cast` (GHC.Types.N:IO[0]
+ <Ptr
+ Word8>_R
+ :: IO
+ (Ptr
+ Word8)
+ ~R# (GHC.Prim.State#
+ GHC.Prim.RealWorld
+ -> (# GHC.Prim.State#
+ GHC.Prim.RealWorld,
+ Ptr
+ Word8 #))))
+ sc3_s2ah
+ of
+ { (# ipv_a26L,
+ ipv1_a26M #) ->
+ joinrec {
+ $wgo_Xk [InlPrag=[2],
+ Occ=LoopBreaker,
+ Dmd=SCS(C1(C1(!P(L,L))))]
+ :: GHC.Prim.Int#
+ -> Ptr
+ Word8
+ -> GHC.Prim.State#
+ GHC.Prim.RealWorld
+ -> (# GHC.Prim.State#
+ GHC.Prim.RealWorld,
+ B.BuildSignal
+ r_a238 #)
+ [LclId[JoinId(3)(Just [~,
+ !])],
+ Arity=3,
+ Str=<L><1L><L>,
+ Unf=OtherCon []]
+ $wgo_Xk (ww_Xl
+ :: GHC.Prim.Int#)
+ (op_Xm
+ :: Ptr
+ Word8)
+ (eta6_Xn [OS=OneShot]
+ :: GHC.Prim.State#
+ GHC.Prim.RealWorld)
+ = case op_Xm
+ of op1_Xo
+ { GHC.Ptr.Ptr ipv2_Xp ->
+ case GHC.Prim.<#
+ ww_Xl
+ iendTmp_s27v
+ of {
+ __DEFAULT ->
+ $s$wouterLoop_s29Y
+ ipv2_Xp
+ sc1_s29W
+ ww_Xl
+ eta6_Xn;
+ 1# ->
+ case GHC.Prim.indexWord8Array#
+ bx_d22M
+ ww_Xl
+ of r#1_Xr
+ { __DEFAULT ->
+ case GHC.Prim.ltWord8#
+ r#1_Xr
+ 128##8
+ of {
+ __DEFAULT ->
+ case GHC.Prim.writeWord8OffAddr#
+ @GHC.Prim.RealWorld
+ ipv2_Xp
+ 0#
+ r#1_Xr
+ eta6_Xn
+ of s2_a26u
+ { __DEFAULT ->
+ jump $wgo_Xk
+ (GHC.Prim.+#
+ ww_Xl
+ 1#)
+ (GHC.Ptr.Ptr
+ @Word8
+ (GHC.Prim.plusAddr#
+ ipv2_Xp
+ 1#))
+ s2_a26u
+ };
+ 1# ->
+ case ((ds1_a27N
+ (GHC.Word.W8#
+ r#1_Xr)
+ op1_Xo)
+ `cast` (GHC.Types.N:IO[0]
+ <Ptr
+ Word8>_R
+ :: IO
+ (Ptr
+ Word8)
+ ~R# (GHC.Prim.State#
+ GHC.Prim.RealWorld
+ -> (# GHC.Prim.State#
+ GHC.Prim.RealWorld,
+ Ptr
+ Word8 #))))
+ eta6_Xn
+ of
+ { (# ipv3_Xu,
+ ipv4_Xv #) ->
+ jump $wgo_Xk
+ (GHC.Prim.+#
+ ww_Xl
+ 1#)
+ ipv4_Xv
+ ipv3_Xu
+ }
+ }
+ }
+ }
+ }; } in
+ jump $wgo_Xk
+ (GHC.Prim.+#
+ sc5_s2af 1#)
+ ipv1_a26M
+ ipv_a26L
+ }
+ }
+ }
+ }; } in
+ jump $s$wgo_s2ai
+ eta5_s28W
+ sc_s29V
+ sc2_s29U } in
+ case GHC.Prim.<=# ds4_Xg y1_s27t of {
+ __DEFAULT -> jump $j3_s27P y1_s27t;
+ 1# -> jump $j3_s27P ds4_Xg
+ }
+ }
+ } } in
+ case wild3_X6 of {
+ __DEFAULT -> jump $j2_Xf;
+ -1# ->
+ case a1_Xe of {
+ __DEFAULT -> jump $j2_Xf;
+ -9223372036854775808# ->
+ case GHC.Real.overflowError
+ of wild6_00 {
+ }
+ }
+ };
+ 1# ->
+ ((k_X2
+ (Data.ByteString.Builder.Internal.BufferRange
+ sc_s29V sc1_s29W))
+ `cast` (GHC.Types.N:IO[0]
+ <B.BuildSignal r_a238>_R
+ :: IO (B.BuildSignal r_a238)
+ ~R# (GHC.Prim.State#
+ GHC.Prim.RealWorld
+ -> (# GHC.Prim.State#
+ GHC.Prim.RealWorld,
+ B.BuildSignal
+ r_a238 #))))
+ eta5_s28W
+ };
+ $wouterLoop_s28Y [InlPrag=[2],
+ Occ=LoopBreaker,
+ Dmd=SCS(C1(C1(L)))]
+ :: GHC.Prim.Int#
+ -> B.BufferRange
+ -> GHC.Prim.State# GHC.Prim.RealWorld
+ -> (# GHC.Prim.State# GHC.Prim.RealWorld,
+ B.BuildSignal r_a238 #)
+ [LclId[StrictWorker([~, !])],
+ Arity=3,
+ Str=<L><1L><L>,
+ Unf=OtherCon []]
+ $wouterLoop_s28Y
+ = \ (ww_s28T :: GHC.Prim.Int#)
+ (br1_s28V :: B.BufferRange)
+ (eta5_s28W [OS=OneShot]
+ :: GHC.Prim.State# GHC.Prim.RealWorld) ->
+ case br1_s28V of wild4_X9
+ { B.BufferRange bx6_Xa bx7_Xb ->
+ case GHC.Prim.>=# ww_s28T iend_s27f of {
+ __DEFAULT ->
+ let {
+ a1_Xe :: GHC.Prim.Int#
+ [LclId]
+ a1_Xe = GHC.Prim.minusAddr# bx7_Xb bx6_Xa } in
+ join {
+ $j2_Xf [Dmd=1!P(L,L)]
+ :: (# GHC.Prim.State# GHC.Prim.RealWorld,
+ B.BuildSignal r_a238 #)
+ [LclId[JoinId(0)(Nothing)]]
+ $j2_Xf
+ = case GHC.Prim.quotInt# a1_Xe wild3_X6
+ of ds4_Xg
+ { __DEFAULT ->
+ case GHC.Prim.># ds4_Xg 0# of {
+ __DEFAULT ->
+ (# eta5_s28W,
+ Data.ByteString.Builder.Internal.BufferFull
+ @r_a238
+ wild3_X6
+ bx6_Xa
+ ((\ (br2_Xi :: B.BufferRange)
+ (eta6_Xj [OS=OneShot]
+ :: GHC.Prim.State#
+ GHC.Prim.RealWorld) ->
+ $wouterLoop_s28Y
+ ww_s28T br2_Xi eta6_Xj)
+ `cast` (<B.BufferRange>_R
+ %<'Many>_N ->_R Sym (GHC.Types.N:IO[0]
+ <B.BuildSignal
+ r_a238>_R)
+ :: (B.BufferRange
+ -> GHC.Prim.State#
+ GHC.Prim.RealWorld
+ -> (# GHC.Prim.State#
+ GHC.Prim.RealWorld,
+ B.BuildSignal
+ r_a238 #))
+ ~R# (B.BufferRange
+ -> IO
+ (B.BuildSignal
+ r_a238)))) #);
+ 1# ->
+ let {
+ y1_s27t :: GHC.Prim.Int#
+ [LclId]
+ y1_s27t
+ = GHC.Prim.-#
+ iend_s27f ww_s28T } in
+ join {
+ $j3_s27P [Dmd=1C1(!P(L,L))]
+ :: GHC.Prim.Int#
+ -> (# GHC.Prim.State#
+ GHC.Prim.RealWorld,
+ B.BuildSignal r_a238 #)
+ [LclId[JoinId(1)(Nothing)],
+ Arity=1,
+ Str=<L>,
+ Unf=OtherCon []]
+ $j3_s27P (y_a23f [OS=OneShot]
+ :: GHC.Prim.Int#)
+ = let {
+ iendTmp_s27v :: GHC.Prim.Int#
+ [LclId]
+ iendTmp_s27v
+ = GHC.Prim.+#
+ ww_s28T y_a23f } in
+ joinrec {
+ $s$wgo_s29j [Occ=LoopBreaker,
+ Dmd=SCS(C1(C1(!P(L,L))))]
+ :: GHC.Prim.State#
+ GHC.Prim.RealWorld
+ -> GHC.Prim.Addr#
+ -> GHC.Prim.Int#
+ -> (# GHC.Prim.State#
+ GHC.Prim.RealWorld,
+ B.BuildSignal
+ r_a238 #)
+ [LclId[JoinId(3)(Nothing)],
+ Arity=3,
+ Str=<L><L><L>,
+ Unf=OtherCon []]
+ $s$wgo_s29j (sc_s29i
+ :: GHC.Prim.State#
+ GHC.Prim.RealWorld)
+ (sc1_s29h
+ :: GHC.Prim.Addr#)
+ (sc2_s29g
+ :: GHC.Prim.Int#)
+ = case GHC.Prim.<#
+ sc2_s29g
+ iendTmp_s27v
+ of {
+ __DEFAULT ->
+ $s$wouterLoop_s29Y
+ sc1_s29h
+ bx7_Xb
+ sc2_s29g
+ sc_s29i;
+ 1# ->
+ case GHC.Prim.indexWord8Array#
+ bx_d22M
+ sc2_s29g
+ of r#_a24P
+ { __DEFAULT ->
+ case GHC.Prim.ltWord8#
+ r#_a24P 128##8
+ of {
+ __DEFAULT ->
+ case GHC.Prim.writeWord8OffAddr#
+ @GHC.Prim.RealWorld
+ sc1_s29h
+ 0#
+ r#_a24P
+ sc_s29i
+ of s2_a26u
+ { __DEFAULT ->
+ jump $s$wgo_s29j
+ s2_a26u
+ (GHC.Prim.plusAddr#
+ sc1_s29h 1#)
+ (GHC.Prim.+#
+ sc2_s29g 1#)
+ };
+ 1# ->
+ case ((ds1_a27N
+ (GHC.Word.W8#
+ r#_a24P)
+ (GHC.Ptr.Ptr
+ @Word8
+ sc1_s29h))
+ `cast` (GHC.Types.N:IO[0]
+ <Ptr
+ Word8>_R
+ :: IO
+ (Ptr
+ Word8)
+ ~R# (GHC.Prim.State#
+ GHC.Prim.RealWorld
+ -> (# GHC.Prim.State#
+ GHC.Prim.RealWorld,
+ Ptr
+ Word8 #))))
+ sc_s29i
+ of
+ { (# ipv_a26L,
+ ipv1_a26M #) ->
+ joinrec {
+ $s$wgo1_s29t [Occ=LoopBreaker,
+ Dmd=LCS(C1(C1(!P(L,L))))]
+ :: GHC.Prim.State#
+ GHC.Prim.RealWorld
+ -> GHC.Prim.Addr#
+ -> GHC.Prim.Int#
+ -> (# GHC.Prim.State#
+ GHC.Prim.RealWorld,
+ B.BuildSignal
+ r_a238 #)
+ [LclId[JoinId(3)(Nothing)],
+ Arity=3,
+ Str=<L><L><L>,
+ Unf=OtherCon []]
+ $s$wgo1_s29t (sc3_s29p
+ :: GHC.Prim.State#
+ GHC.Prim.RealWorld)
+ (sc4_s29o
+ :: GHC.Prim.Addr#)
+ (sc5_s29n
+ :: GHC.Prim.Int#)
+ = case GHC.Prim.<#
+ sc5_s29n
+ iendTmp_s27v
+ of {
+ __DEFAULT ->
+ $s$wouterLoop_s29Y
+ sc4_s29o
+ bx7_Xb
+ sc5_s29n
+ sc3_s29p;
+ 1# ->
+ case GHC.Prim.indexWord8Array#
+ bx_d22M
+ sc5_s29n
+ of r#1_Xr
+ { __DEFAULT ->
+ case GHC.Prim.ltWord8#
+ r#1_Xr
+ 128##8
+ of {
+ __DEFAULT ->
+ case GHC.Prim.writeWord8OffAddr#
+ @GHC.Prim.RealWorld
+ sc4_s29o
+ 0#
+ r#1_Xr
+ sc3_s29p
+ of s2_a26u
+ { __DEFAULT ->
+ jump $s$wgo1_s29t
+ s2_a26u
+ (GHC.Prim.plusAddr#
+ sc4_s29o
+ 1#)
+ (GHC.Prim.+#
+ sc5_s29n
+ 1#)
+ };
+ 1# ->
+ case ((ds1_a27N
+ (GHC.Word.W8#
+ r#1_Xr)
+ (GHC.Ptr.Ptr
+ @Word8
+ sc4_s29o))
+ `cast` (GHC.Types.N:IO[0]
+ <Ptr
+ Word8>_R
+ :: IO
+ (Ptr
+ Word8)
+ ~R# (GHC.Prim.State#
+ GHC.Prim.RealWorld
+ -> (# GHC.Prim.State#
+ GHC.Prim.RealWorld,
+ Ptr
+ Word8 #))))
+ sc3_s29p
+ of
+ { (# ipv2_Xu,
+ ipv3_Xv #) ->
+ jump $wgo_Xk
+ (GHC.Prim.+#
+ sc5_s29n
+ 1#)
+ ipv3_Xv
+ ipv2_Xu
+ }
+ }
+ }
+ };
+ $wgo_Xk [InlPrag=[2],
+ Occ=LoopBreaker,
+ Dmd=SCS(C1(C1(!P(L,L))))]
+ :: GHC.Prim.Int#
+ -> Ptr
+ Word8
+ -> GHC.Prim.State#
+ GHC.Prim.RealWorld
+ -> (# GHC.Prim.State#
+ GHC.Prim.RealWorld,
+ B.BuildSignal
+ r_a238 #)
+ [LclId[JoinId(3)(Just [~,
+ !])],
+ Arity=3,
+ Str=<L><1L><L>,
+ Unf=OtherCon []]
+ $wgo_Xk (ww1_Xl
+ :: GHC.Prim.Int#)
+ (op_Xm
+ :: Ptr
+ Word8)
+ (eta6_Xn [OS=OneShot]
+ :: GHC.Prim.State#
+ GHC.Prim.RealWorld)
+ = case op_Xm
+ of op1_Xo
+ { GHC.Ptr.Ptr ipv2_Xp ->
+ case GHC.Prim.<#
+ ww1_Xl
+ iendTmp_s27v
+ of {
+ __DEFAULT ->
+ $s$wouterLoop_s29Y
+ ipv2_Xp
+ bx7_Xb
+ ww1_Xl
+ eta6_Xn;
+ 1# ->
+ case GHC.Prim.indexWord8Array#
+ bx_d22M
+ ww1_Xl
+ of r#1_Xr
+ { __DEFAULT ->
+ case GHC.Prim.ltWord8#
+ r#1_Xr
+ 128##8
+ of {
+ __DEFAULT ->
+ case GHC.Prim.writeWord8OffAddr#
+ @GHC.Prim.RealWorld
+ ipv2_Xp
+ 0#
+ r#1_Xr
+ eta6_Xn
+ of s2_a26u
+ { __DEFAULT ->
+ jump $s$wgo1_s29t
+ s2_a26u
+ (GHC.Prim.plusAddr#
+ ipv2_Xp
+ 1#)
+ (GHC.Prim.+#
+ ww1_Xl
+ 1#)
+ };
+ 1# ->
+ case ((ds1_a27N
+ (GHC.Word.W8#
+ r#1_Xr)
+ op1_Xo)
+ `cast` (GHC.Types.N:IO[0]
+ <Ptr
+ Word8>_R
+ :: IO
+ (Ptr
+ Word8)
+ ~R# (GHC.Prim.State#
+ GHC.Prim.RealWorld
+ -> (# GHC.Prim.State#
+ GHC.Prim.RealWorld,
+ Ptr
+ Word8 #))))
+ eta6_Xn
+ of
+ { (# ipv3_Xu,
+ ipv4_Xv #) ->
+ jump $wgo_Xk
+ (GHC.Prim.+#
+ ww1_Xl
+ 1#)
+ ipv4_Xv
+ ipv3_Xu
+ }
+ }
+ }
+ }
+ }; } in
+ jump $wgo_Xk
+ (GHC.Prim.+#
+ sc2_s29g 1#)
+ ipv1_a26M
+ ipv_a26L
+ }
+ }
+ }
+ }; } in
+ jump $s$wgo_s29j
+ eta5_s28W bx6_Xa ww_s28T } in
+ case GHC.Prim.<=# ds4_Xg y1_s27t of {
+ __DEFAULT -> jump $j3_s27P y1_s27t;
+ 1# -> jump $j3_s27P ds4_Xg
+ }
+ }
+ } } in
+ case wild3_X6 of {
+ __DEFAULT -> jump $j2_Xf;
+ -1# ->
+ case a1_Xe of {
+ __DEFAULT -> jump $j2_Xf;
+ -9223372036854775808# ->
+ case GHC.Real.overflowError
+ of wild7_00 {
+ }
+ }
+ };
+ 1# ->
+ ((k_X2 wild4_X9)
+ `cast` (GHC.Types.N:IO[0]
+ <B.BuildSignal r_a238>_R
+ :: IO (B.BuildSignal r_a238)
+ ~R# (GHC.Prim.State#
+ GHC.Prim.RealWorld
+ -> (# GHC.Prim.State#
+ GHC.Prim.RealWorld,
+ B.BuildSignal
+ r_a238 #))))
+ eta5_s28W
+ }
+ }; } in
+ $wouterLoop_s28Y bx1_d22N br_X7 eta4_X8)
+ `cast` (<B.BufferRange>_R
+ %<'Many>_N ->_R Sym (GHC.Types.N:IO[0]
+ <B.BuildSignal r_a238>_R)
+ :: (B.BufferRange
+ -> GHC.Prim.State# GHC.Prim.RealWorld
+ -> (# GHC.Prim.State# GHC.Prim.RealWorld,
+ B.BuildSignal r_a238 #))
+ ~R# (B.BufferRange
+ -> IO (B.BuildSignal r_a238)))) #);
+ 1# ->
+ let {
+ y1_s27t :: GHC.Prim.Int#
+ [LclId]
+ y1_s27t = GHC.Prim.-# iend_s27f bx1_d22N } in
+ join {
+ $j2_s27P [Dmd=1C1(!P(L,L))]
+ :: GHC.Prim.Int#
+ -> (# GHC.Prim.State# GHC.Prim.RealWorld,
+ B.BuildSignal r_a238 #)
+ [LclId[JoinId(1)(Nothing)], Arity=1, Str=<L>, Unf=OtherCon []]
+ $j2_s27P (y_a23f [OS=OneShot] :: GHC.Prim.Int#)
+ = let {
+ iendTmp_s27v :: GHC.Prim.Int#
+ [LclId]
+ iendTmp_s27v = GHC.Prim.+# bx1_d22N y_a23f } in
+ join {
+ exit_Xc [Dmd=LCS(C1(C1(!P(L,L))))]
+ :: GHC.Prim.Int#
+ -> GHC.Prim.State# GHC.Prim.RealWorld
+ -> GHC.Prim.Addr#
+ -> (# GHC.Prim.State# GHC.Prim.RealWorld,
+ B.BuildSignal r_a238 #)
+ [LclId[JoinId(3)(Nothing)],
+ Arity=3,
+ Str=<L><L><L>,
+ Unf=OtherCon []]
+ exit_Xc (ww_s28F [OS=OneShot] :: GHC.Prim.Int#)
+ (eta4_s28I [OS=OneShot]
+ :: GHC.Prim.State# GHC.Prim.RealWorld)
+ (ipv_s24F [OS=OneShot] :: GHC.Prim.Addr#)
+ = letrec {
+ $s$wouterLoop_s2bC [Occ=LoopBreaker,
+ Dmd=SCS(C1(C1(C1(!P(L,L)))))]
+ :: GHC.Prim.Addr#
+ -> GHC.Prim.Addr#
+ -> GHC.Prim.Int#
+ -> GHC.Prim.State# GHC.Prim.RealWorld
+ -> (# GHC.Prim.State# GHC.Prim.RealWorld,
+ B.BuildSignal r_a238 #)
+ [LclId, Arity=4, Str=<L><L><L><L>, Unf=OtherCon []]
+ $s$wouterLoop_s2bC
+ = \ (sc_s2bz :: GHC.Prim.Addr#)
+ (sc1_s2bA :: GHC.Prim.Addr#)
+ (sc2_s2by :: GHC.Prim.Int#)
+ (eta5_s28W [OS=OneShot]
+ :: GHC.Prim.State# GHC.Prim.RealWorld) ->
+ case GHC.Prim.>=# sc2_s2by iend_s27f of {
+ __DEFAULT ->
+ let {
+ a1_Xi :: GHC.Prim.Int#
+ [LclId]
+ a1_Xi
+ = GHC.Prim.minusAddr#
+ sc1_s2bA sc_s2bz } in
+ join {
+ $j3_Xj [Dmd=1!P(L,L)]
+ :: (# GHC.Prim.State# GHC.Prim.RealWorld,
+ B.BuildSignal r_a238 #)
+ [LclId[JoinId(0)(Nothing)]]
+ $j3_Xj
+ = case GHC.Prim.quotInt# a1_Xi wild3_X6
+ of ds4_Xk
+ { __DEFAULT ->
+ case GHC.Prim.># ds4_Xk 0# of {
+ __DEFAULT ->
+ (# eta5_s28W,
+ Data.ByteString.Builder.Internal.BufferFull
+ @r_a238
+ wild3_X6
+ sc_s2bz
+ ((\ (br_X7 :: B.BufferRange)
+ (eta6_X8 [OS=OneShot]
+ :: GHC.Prim.State#
+ GHC.Prim.RealWorld) ->
+ $wouterLoop_s28Y
+ sc2_s2by br_X7 eta6_X8)
+ `cast` (<B.BufferRange>_R
+ %<'Many>_N ->_R Sym (GHC.Types.N:IO[0]
+ <B.BuildSignal
+ r_a238>_R)
+ :: (B.BufferRange
+ -> GHC.Prim.State#
+ GHC.Prim.RealWorld
+ -> (# GHC.Prim.State#
+ GHC.Prim.RealWorld,
+ B.BuildSignal
+ r_a238 #))
+ ~R# (B.BufferRange
+ -> IO
+ (B.BuildSignal
+ r_a238)))) #);
+ 1# ->
+ let {
+ y2_Xm :: GHC.Prim.Int#
+ [LclId]
+ y2_Xm
+ = GHC.Prim.-#
+ iend_s27f sc2_s2by } in
+ join {
+ $j4_Xn [Dmd=1C1(!P(L,L))]
+ :: GHC.Prim.Int#
+ -> (# GHC.Prim.State#
+ GHC.Prim.RealWorld,
+ B.BuildSignal
+ r_a238 #)
+ [LclId[JoinId(1)(Nothing)],
+ Arity=1,
+ Str=<L>,
+ Unf=OtherCon []]
+ $j4_Xn (y3_Xo [OS=OneShot]
+ :: GHC.Prim.Int#)
+ = let {
+ iendTmp1_Xp
+ :: GHC.Prim.Int#
+ [LclId]
+ iendTmp1_Xp
+ = GHC.Prim.+#
+ sc2_s2by y3_Xo } in
+ joinrec {
+ $s$wgo_s2bW [Occ=LoopBreaker,
+ Dmd=SCS(C1(C1(!P(L,L))))]
+ :: GHC.Prim.State#
+ GHC.Prim.RealWorld
+ -> GHC.Prim.Addr#
+ -> GHC.Prim.Int#
+ -> (# GHC.Prim.State#
+ GHC.Prim.RealWorld,
+ B.BuildSignal
+ r_a238 #)
+ [LclId[JoinId(3)(Nothing)],
+ Arity=3,
+ Str=<L><L><L>,
+ Unf=OtherCon []]
+ $s$wgo_s2bW (sc3_s2bV
+ :: GHC.Prim.State#
+ GHC.Prim.RealWorld)
+ (sc4_s2bU
+ :: GHC.Prim.Addr#)
+ (sc5_s2bT
+ :: GHC.Prim.Int#)
+ = case GHC.Prim.<#
+ sc5_s2bT
+ iendTmp1_Xp
+ of {
+ __DEFAULT ->
+ $s$wouterLoop_s2bC
+ sc4_s2bU
+ sc1_s2bA
+ sc5_s2bT
+ sc3_s2bV;
+ 1# ->
+ case GHC.Prim.indexWord8Array#
+ bx_d22M
+ sc5_s2bT
+ of r#_a24P
+ { __DEFAULT ->
+ case GHC.Prim.ltWord8#
+ r#_a24P
+ 128##8
+ of {
+ __DEFAULT ->
+ case GHC.Prim.writeWord8OffAddr#
+ @GHC.Prim.RealWorld
+ sc4_s2bU
+ 0#
+ r#_a24P
+ sc3_s2bV
+ of s2_a26u
+ { __DEFAULT ->
+ jump $s$wgo_s2bW
+ s2_a26u
+ (GHC.Prim.plusAddr#
+ sc4_s2bU
+ 1#)
+ (GHC.Prim.+#
+ sc5_s2bT
+ 1#)
+ };
+ 1# ->
+ case ((ds1_a27N
+ (GHC.Word.W8#
+ r#_a24P)
+ (GHC.Ptr.Ptr
+ @Word8
+ sc4_s2bU))
+ `cast` (GHC.Types.N:IO[0]
+ <Ptr
+ Word8>_R
+ :: IO
+ (Ptr
+ Word8)
+ ~R# (GHC.Prim.State#
+ GHC.Prim.RealWorld
+ -> (# GHC.Prim.State#
+ GHC.Prim.RealWorld,
+ Ptr
+ Word8 #))))
+ sc3_s2bV
+ of
+ { (# ipv1_a26L,
+ ipv2_a26M #) ->
+ joinrec {
+ $wgo_Xu [InlPrag=[2],
+ Occ=LoopBreaker,
+ Dmd=SCS(C1(C1(!P(L,L))))]
+ :: GHC.Prim.Int#
+ -> Ptr
+ Word8
+ -> GHC.Prim.State#
+ GHC.Prim.RealWorld
+ -> (# GHC.Prim.State#
+ GHC.Prim.RealWorld,
+ B.BuildSignal
+ r_a238 #)
+ [LclId[JoinId(3)(Just [~,
+ !])],
+ Arity=3,
+ Str=<L><1L><L>,
+ Unf=OtherCon []]
+ $wgo_Xu (ww1_Xv
+ :: GHC.Prim.Int#)
+ (op_Xw
+ :: Ptr
+ Word8)
+ (eta6_Xx [OS=OneShot]
+ :: GHC.Prim.State#
+ GHC.Prim.RealWorld)
+ = case op_Xw
+ of op1_Xy
+ { GHC.Ptr.Ptr ipv3_Xz ->
+ case GHC.Prim.<#
+ ww1_Xv
+ iendTmp1_Xp
+ of {
+ __DEFAULT ->
+ $s$wouterLoop_s2bC
+ ipv3_Xz
+ sc1_s2bA
+ ww1_Xv
+ eta6_Xx;
+ 1# ->
+ case GHC.Prim.indexWord8Array#
+ bx_d22M
+ ww1_Xv
+ of r#1_XB
+ { __DEFAULT ->
+ case GHC.Prim.ltWord8#
+ r#1_XB
+ 128##8
+ of {
+ __DEFAULT ->
+ case GHC.Prim.writeWord8OffAddr#
+ @GHC.Prim.RealWorld
+ ipv3_Xz
+ 0#
+ r#1_XB
+ eta6_Xx
+ of s2_a26u
+ { __DEFAULT ->
+ jump $wgo_Xu
+ (GHC.Prim.+#
+ ww1_Xv
+ 1#)
+ (GHC.Ptr.Ptr
+ @Word8
+ (GHC.Prim.plusAddr#
+ ipv3_Xz
+ 1#))
+ s2_a26u
+ };
+ 1# ->
+ case ((ds1_a27N
+ (GHC.Word.W8#
+ r#1_XB)
+ op1_Xy)
+ `cast` (GHC.Types.N:IO[0]
+ <Ptr
+ Word8>_R
+ :: IO
+ (Ptr
+ Word8)
+ ~R# (GHC.Prim.State#
+ GHC.Prim.RealWorld
+ -> (# GHC.Prim.State#
+ GHC.Prim.RealWorld,
+ Ptr
+ Word8 #))))
+ eta6_Xx
+ of
+ { (# ipv4_XE,
+ ipv5_XF #) ->
+ jump $wgo_Xu
+ (GHC.Prim.+#
+ ww1_Xv
+ 1#)
+ ipv5_XF
+ ipv4_XE
+ }
+ }
+ }
+ }
+ }; } in
+ jump $wgo_Xu
+ (GHC.Prim.+#
+ sc5_s2bT
+ 1#)
+ ipv2_a26M
+ ipv1_a26L
+ }
+ }
+ }
+ }; } in
+ jump $s$wgo_s2bW
+ eta5_s28W
+ sc_s2bz
+ sc2_s2by } in
+ case GHC.Prim.<=# ds4_Xk y2_Xm of {
+ __DEFAULT -> jump $j4_Xn y2_Xm;
+ 1# -> jump $j4_Xn ds4_Xk
+ }
+ }
+ } } in
+ case wild3_X6 of {
+ __DEFAULT -> jump $j3_Xj;
+ -1# ->
+ case a1_Xi of {
+ __DEFAULT -> jump $j3_Xj;
+ -9223372036854775808# ->
+ case GHC.Real.overflowError
+ of wild6_00 {
+ }
+ }
+ };
+ 1# ->
+ ((k_X2
+ (Data.ByteString.Builder.Internal.BufferRange
+ sc_s2bz sc1_s2bA))
+ `cast` (GHC.Types.N:IO[0]
+ <B.BuildSignal r_a238>_R
+ :: IO (B.BuildSignal r_a238)
+ ~R# (GHC.Prim.State#
+ GHC.Prim.RealWorld
+ -> (# GHC.Prim.State#
+ GHC.Prim.RealWorld,
+ B.BuildSignal
+ r_a238 #))))
+ eta5_s28W
+ };
+ $wouterLoop_s28Y [InlPrag=[2],
+ Occ=LoopBreaker,
+ Dmd=LCS(C1(C1(L)))]
+ :: GHC.Prim.Int#
+ -> B.BufferRange
+ -> GHC.Prim.State# GHC.Prim.RealWorld
+ -> (# GHC.Prim.State# GHC.Prim.RealWorld,
+ B.BuildSignal r_a238 #)
+ [LclId[StrictWorker([~, !])],
+ Arity=3,
+ Str=<L><1L><L>,
+ Unf=OtherCon []]
+ $wouterLoop_s28Y
+ = \ (ww1_s28T :: GHC.Prim.Int#)
+ (br_s28V :: B.BufferRange)
+ (eta5_s28W [OS=OneShot]
+ :: GHC.Prim.State# GHC.Prim.RealWorld) ->
+ case br_s28V of wild4_Xd
+ { B.BufferRange bx6_Xe bx7_Xf ->
+ case GHC.Prim.>=# ww1_s28T iend_s27f of {
+ __DEFAULT ->
+ let {
+ a1_Xi :: GHC.Prim.Int#
+ [LclId]
+ a1_Xi
+ = GHC.Prim.minusAddr# bx7_Xf bx6_Xe } in
+ join {
+ $j3_Xj [Dmd=1!P(L,L)]
+ :: (# GHC.Prim.State# GHC.Prim.RealWorld,
+ B.BuildSignal r_a238 #)
+ [LclId[JoinId(0)(Nothing)]]
+ $j3_Xj
+ = case GHC.Prim.quotInt# a1_Xi wild3_X6
+ of ds4_Xk
+ { __DEFAULT ->
+ case GHC.Prim.># ds4_Xk 0# of {
+ __DEFAULT ->
+ (# eta5_s28W,
+ Data.ByteString.Builder.Internal.BufferFull
+ @r_a238
+ wild3_X6
+ bx6_Xe
+ ((\ (br1_X7 :: B.BufferRange)
+ (eta6_X8 [OS=OneShot]
+ :: GHC.Prim.State#
+ GHC.Prim.RealWorld) ->
+ $wouterLoop_s28Y
+ ww1_s28T br1_X7 eta6_X8)
+ `cast` (<B.BufferRange>_R
+ %<'Many>_N ->_R Sym (GHC.Types.N:IO[0]
+ <B.BuildSignal
+ r_a238>_R)
+ :: (B.BufferRange
+ -> GHC.Prim.State#
+ GHC.Prim.RealWorld
+ -> (# GHC.Prim.State#
+ GHC.Prim.RealWorld,
+ B.BuildSignal
+ r_a238 #))
+ ~R# (B.BufferRange
+ -> IO
+ (B.BuildSignal
+ r_a238)))) #);
+ 1# ->
+ let {
+ y2_Xm :: GHC.Prim.Int#
+ [LclId]
+ y2_Xm
+ = GHC.Prim.-#
+ iend_s27f ww1_s28T } in
+ join {
+ $j4_Xn [Dmd=1C1(!P(L,L))]
+ :: GHC.Prim.Int#
+ -> (# GHC.Prim.State#
+ GHC.Prim.RealWorld,
+ B.BuildSignal
+ r_a238 #)
+ [LclId[JoinId(1)(Nothing)],
+ Arity=1,
+ Str=<L>,
+ Unf=OtherCon []]
+ $j4_Xn (y3_Xo [OS=OneShot]
+ :: GHC.Prim.Int#)
+ = let {
+ iendTmp1_Xp
+ :: GHC.Prim.Int#
+ [LclId]
+ iendTmp1_Xp
+ = GHC.Prim.+#
+ ww1_s28T y3_Xo } in
+ joinrec {
+ $s$wgo_s2b3 [Occ=LoopBreaker,
+ Dmd=SCS(C1(C1(!P(L,L))))]
+ :: GHC.Prim.State#
+ GHC.Prim.RealWorld
+ -> GHC.Prim.Addr#
+ -> GHC.Prim.Int#
+ -> (# GHC.Prim.State#
+ GHC.Prim.RealWorld,
+ B.BuildSignal
+ r_a238 #)
+ [LclId[JoinId(3)(Nothing)],
+ Arity=3,
+ Str=<L><L><L>,
+ Unf=OtherCon []]
+ $s$wgo_s2b3 (sc_s2b2
+ :: GHC.Prim.State#
+ GHC.Prim.RealWorld)
+ (sc1_s2b1
+ :: GHC.Prim.Addr#)
+ (sc2_s2b0
+ :: GHC.Prim.Int#)
+ = case GHC.Prim.<#
+ sc2_s2b0
+ iendTmp1_Xp
+ of {
+ __DEFAULT ->
+ $s$wouterLoop_s2bC
+ sc1_s2b1
+ bx7_Xf
+ sc2_s2b0
+ sc_s2b2;
+ 1# ->
+ case GHC.Prim.indexWord8Array#
+ bx_d22M
+ sc2_s2b0
+ of r#_a24P
+ { __DEFAULT ->
+ case GHC.Prim.ltWord8#
+ r#_a24P
+ 128##8
+ of {
+ __DEFAULT ->
+ case GHC.Prim.writeWord8OffAddr#
+ @GHC.Prim.RealWorld
+ sc1_s2b1
+ 0#
+ r#_a24P
+ sc_s2b2
+ of s2_a26u
+ { __DEFAULT ->
+ jump $s$wgo_s2b3
+ s2_a26u
+ (GHC.Prim.plusAddr#
+ sc1_s2b1
+ 1#)
+ (GHC.Prim.+#
+ sc2_s2b0
+ 1#)
+ };
+ 1# ->
+ case ((ds1_a27N
+ (GHC.Word.W8#
+ r#_a24P)
+ (GHC.Ptr.Ptr
+ @Word8
+ sc1_s2b1))
+ `cast` (GHC.Types.N:IO[0]
+ <Ptr
+ Word8>_R
+ :: IO
+ (Ptr
+ Word8)
+ ~R# (GHC.Prim.State#
+ GHC.Prim.RealWorld
+ -> (# GHC.Prim.State#
+ GHC.Prim.RealWorld,
+ Ptr
+ Word8 #))))
+ sc_s2b2
+ of
+ { (# ipv1_a26L,
+ ipv2_a26M #) ->
+ joinrec {
+ $s$wgo1_s2bd [Occ=LoopBreaker,
+ Dmd=LCS(C1(C1(!P(L,L))))]
+ :: GHC.Prim.State#
+ GHC.Prim.RealWorld
+ -> GHC.Prim.Addr#
+ -> GHC.Prim.Int#
+ -> (# GHC.Prim.State#
+ GHC.Prim.RealWorld,
+ B.BuildSignal
+ r_a238 #)
+ [LclId[JoinId(3)(Nothing)],
+ Arity=3,
+ Str=<L><L><L>,
+ Unf=OtherCon []]
+ $s$wgo1_s2bd (sc3_s2b9
+ :: GHC.Prim.State#
+ GHC.Prim.RealWorld)
+ (sc4_s2b8
+ :: GHC.Prim.Addr#)
+ (sc5_s2b7
+ :: GHC.Prim.Int#)
+ = case GHC.Prim.<#
+ sc5_s2b7
+ iendTmp1_Xp
+ of {
+ __DEFAULT ->
+ $s$wouterLoop_s2bC
+ sc4_s2b8
+ bx7_Xf
+ sc5_s2b7
+ sc3_s2b9;
+ 1# ->
+ case GHC.Prim.indexWord8Array#
+ bx_d22M
+ sc5_s2b7
+ of r#1_XB
+ { __DEFAULT ->
+ case GHC.Prim.ltWord8#
+ r#1_XB
+ 128##8
+ of {
+ __DEFAULT ->
+ case GHC.Prim.writeWord8OffAddr#
+ @GHC.Prim.RealWorld
+ sc4_s2b8
+ 0#
+ r#1_XB
+ sc3_s2b9
+ of s2_a26u
+ { __DEFAULT ->
+ jump $s$wgo1_s2bd
+ s2_a26u
+ (GHC.Prim.plusAddr#
+ sc4_s2b8
+ 1#)
+ (GHC.Prim.+#
+ sc5_s2b7
+ 1#)
+ };
+ 1# ->
+ case ((ds1_a27N
+ (GHC.Word.W8#
+ r#1_XB)
+ (GHC.Ptr.Ptr
+ @Word8
+ sc4_s2b8))
+ `cast` (GHC.Types.N:IO[0]
+ <Ptr
+ Word8>_R
+ :: IO
+ (Ptr
+ Word8)
+ ~R# (GHC.Prim.State#
+ GHC.Prim.RealWorld
+ -> (# GHC.Prim.State#
+ GHC.Prim.RealWorld,
+ Ptr
+ Word8 #))))
+ sc3_s2b9
+ of
+ { (# ipv3_XE,
+ ipv4_XF #) ->
+ jump $wgo_Xu
+ (GHC.Prim.+#
+ sc5_s2b7
+ 1#)
+ ipv4_XF
+ ipv3_XE
+ }
+ }
+ }
+ };
+ $wgo_Xu [InlPrag=[2],
+ Occ=LoopBreaker,
+ Dmd=SCS(C1(C1(!P(L,L))))]
+ :: GHC.Prim.Int#
+ -> Ptr
+ Word8
+ -> GHC.Prim.State#
+ GHC.Prim.RealWorld
+ -> (# GHC.Prim.State#
+ GHC.Prim.RealWorld,
+ B.BuildSignal
+ r_a238 #)
+ [LclId[JoinId(3)(Just [~,
+ !])],
+ Arity=3,
+ Str=<L><1L><L>,
+ Unf=OtherCon []]
+ $wgo_Xu (ww2_Xv
+ :: GHC.Prim.Int#)
+ (op_Xw
+ :: Ptr
+ Word8)
+ (eta6_Xx [OS=OneShot]
+ :: GHC.Prim.State#
+ GHC.Prim.RealWorld)
+ = case op_Xw
+ of op1_Xy
+ { GHC.Ptr.Ptr ipv3_Xz ->
+ case GHC.Prim.<#
+ ww2_Xv
+ iendTmp1_Xp
+ of {
+ __DEFAULT ->
+ $s$wouterLoop_s2bC
+ ipv3_Xz
+ bx7_Xf
+ ww2_Xv
+ eta6_Xx;
+ 1# ->
+ case GHC.Prim.indexWord8Array#
+ bx_d22M
+ ww2_Xv
+ of r#1_XB
+ { __DEFAULT ->
+ case GHC.Prim.ltWord8#
+ r#1_XB
+ 128##8
+ of {
+ __DEFAULT ->
+ case GHC.Prim.writeWord8OffAddr#
+ @GHC.Prim.RealWorld
+ ipv3_Xz
+ 0#
+ r#1_XB
+ eta6_Xx
+ of s2_a26u
+ { __DEFAULT ->
+ jump $s$wgo1_s2bd
+ s2_a26u
+ (GHC.Prim.plusAddr#
+ ipv3_Xz
+ 1#)
+ (GHC.Prim.+#
+ ww2_Xv
+ 1#)
+ };
+ 1# ->
+ case ((ds1_a27N
+ (GHC.Word.W8#
+ r#1_XB)
+ op1_Xy)
+ `cast` (GHC.Types.N:IO[0]
+ <Ptr
+ Word8>_R
+ :: IO
+ (Ptr
+ Word8)
+ ~R# (GHC.Prim.State#
+ GHC.Prim.RealWorld
+ -> (# GHC.Prim.State#
+ GHC.Prim.RealWorld,
+ Ptr
+ Word8 #))))
+ eta6_Xx
+ of
+ { (# ipv4_XE,
+ ipv5_XF #) ->
+ jump $wgo_Xu
+ (GHC.Prim.+#
+ ww2_Xv
+ 1#)
+ ipv5_XF
+ ipv4_XE
+ }
+ }
+ }
+ }
+ }; } in
+ jump $wgo_Xu
+ (GHC.Prim.+#
+ sc2_s2b0
+ 1#)
+ ipv2_a26M
+ ipv1_a26L
+ }
+ }
+ }
+ }; } in
+ jump $s$wgo_s2b3
+ eta5_s28W
+ bx6_Xe
+ ww1_s28T } in
+ case GHC.Prim.<=# ds4_Xk y2_Xm of {
+ __DEFAULT -> jump $j4_Xn y2_Xm;
+ 1# -> jump $j4_Xn ds4_Xk
+ }
+ }
+ } } in
+ case wild3_X6 of {
+ __DEFAULT -> jump $j3_Xj;
+ -1# ->
+ case a1_Xi of {
+ __DEFAULT -> jump $j3_Xj;
+ -9223372036854775808# ->
+ case GHC.Real.overflowError
+ of wild7_00 {
+ }
+ }
+ };
+ 1# ->
+ ((k_X2 wild4_Xd)
+ `cast` (GHC.Types.N:IO[0]
+ <B.BuildSignal r_a238>_R
+ :: IO (B.BuildSignal r_a238)
+ ~R# (GHC.Prim.State#
+ GHC.Prim.RealWorld
+ -> (# GHC.Prim.State#
+ GHC.Prim.RealWorld,
+ B.BuildSignal
+ r_a238 #))))
+ eta5_s28W
+ }
+ }; } in
+ $s$wouterLoop_s2bC
+ ipv_s24F bx4_d22Q ww_s28F eta4_s28I } in
+ joinrec {
+ $s$wgo_s2cO [Occ=LoopBreaker, Dmd=SCS(C1(C1(!P(L,L))))]
+ :: GHC.Prim.State# GHC.Prim.RealWorld
+ -> GHC.Prim.Addr#
+ -> GHC.Prim.Int#
+ -> (# GHC.Prim.State# GHC.Prim.RealWorld,
+ B.BuildSignal r_a238 #)
+ [LclId[JoinId(3)(Nothing)],
+ Arity=3,
+ Str=<L><L><L>,
+ Unf=OtherCon []]
+ $s$wgo_s2cO (sc_s2cN :: GHC.Prim.State# GHC.Prim.RealWorld)
+ (sc1_s2cM :: GHC.Prim.Addr#)
+ (sc2_s2cL :: GHC.Prim.Int#)
+ = case GHC.Prim.<# sc2_s2cL iendTmp_s27v of {
+ __DEFAULT -> jump exit_Xc sc2_s2cL sc_s2cN sc1_s2cM;
+ 1# ->
+ case GHC.Prim.indexWord8Array# bx_d22M sc2_s2cL
+ of r#_a24P
+ { __DEFAULT ->
+ case GHC.Prim.ltWord8# r#_a24P 128##8 of {
+ __DEFAULT ->
+ case GHC.Prim.writeWord8OffAddr#
+ @GHC.Prim.RealWorld
+ sc1_s2cM
+ 0#
+ r#_a24P
+ sc_s2cN
+ of s2_a26u
+ { __DEFAULT ->
+ jump $s$wgo_s2cO
+ s2_a26u
+ (GHC.Prim.plusAddr# sc1_s2cM 1#)
+ (GHC.Prim.+# sc2_s2cL 1#)
+ };
+ 1# ->
+ case ((ds1_a27N
+ (GHC.Word.W8# r#_a24P)
+ (GHC.Ptr.Ptr @Word8 sc1_s2cM))
+ `cast` (GHC.Types.N:IO[0] <Ptr Word8>_R
+ :: IO (Ptr Word8)
+ ~R# (GHC.Prim.State#
+ GHC.Prim.RealWorld
+ -> (# GHC.Prim.State#
+ GHC.Prim.RealWorld,
+ Ptr Word8 #))))
+ sc_s2cN
+ of
+ { (# ipv_a26L, ipv1_a26M #) ->
+ joinrec {
+ $s$wgo1_s2cY [Occ=LoopBreaker,
+ Dmd=LCS(C1(C1(!P(L,L))))]
+ :: GHC.Prim.State# GHC.Prim.RealWorld
+ -> GHC.Prim.Addr#
+ -> GHC.Prim.Int#
+ -> (# GHC.Prim.State# GHC.Prim.RealWorld,
+ B.BuildSignal r_a238 #)
+ [LclId[JoinId(3)(Nothing)],
+ Arity=3,
+ Str=<L><L><L>,
+ Unf=OtherCon []]
+ $s$wgo1_s2cY (sc3_s2cU
+ :: GHC.Prim.State#
+ GHC.Prim.RealWorld)
+ (sc4_s2cT :: GHC.Prim.Addr#)
+ (sc5_s2cS :: GHC.Prim.Int#)
+ = case GHC.Prim.<# sc5_s2cS iendTmp_s27v of {
+ __DEFAULT ->
+ jump exit_Xc
+ sc5_s2cS sc3_s2cU sc4_s2cT;
+ 1# ->
+ case GHC.Prim.indexWord8Array#
+ bx_d22M sc5_s2cS
+ of r#1_Xk
+ { __DEFAULT ->
+ case GHC.Prim.ltWord8# r#1_Xk 128##8
+ of {
+ __DEFAULT ->
+ case GHC.Prim.writeWord8OffAddr#
+ @GHC.Prim.RealWorld
+ sc4_s2cT
+ 0#
+ r#1_Xk
+ sc3_s2cU
+ of s2_a26u
+ { __DEFAULT ->
+ jump $s$wgo1_s2cY
+ s2_a26u
+ (GHC.Prim.plusAddr# sc4_s2cT 1#)
+ (GHC.Prim.+# sc5_s2cS 1#)
+ };
+ 1# ->
+ case ((ds1_a27N
+ (GHC.Word.W8# r#1_Xk)
+ (GHC.Ptr.Ptr
+ @Word8 sc4_s2cT))
+ `cast` (GHC.Types.N:IO[0]
+ <Ptr Word8>_R
+ :: IO (Ptr Word8)
+ ~R# (GHC.Prim.State#
+ GHC.Prim.RealWorld
+ -> (# GHC.Prim.State#
+ GHC.Prim.RealWorld,
+ Ptr
+ Word8 #))))
+ sc3_s2cU
+ of
+ { (# ipv2_Xn, ipv3_Xo #) ->
+ jump $wgo_Xd
+ (GHC.Prim.+# sc5_s2cS 1#)
+ ipv3_Xo
+ ipv2_Xn
+ }
+ }
+ }
+ };
+ $wgo_Xd [InlPrag=[2],
+ Occ=LoopBreaker,
+ Dmd=SCS(C1(C1(!P(L,L))))]
+ :: GHC.Prim.Int#
+ -> Ptr Word8
+ -> GHC.Prim.State# GHC.Prim.RealWorld
+ -> (# GHC.Prim.State# GHC.Prim.RealWorld,
+ B.BuildSignal r_a238 #)
+ [LclId[JoinId(3)(Just [~, !])],
+ Arity=3,
+ Str=<L><1L><L>,
+ Unf=OtherCon []]
+ $wgo_Xd (ww_Xe :: GHC.Prim.Int#)
+ (op_Xf :: Ptr Word8)
+ (eta4_Xg [OS=OneShot]
+ :: GHC.Prim.State#
+ GHC.Prim.RealWorld)
+ = case op_Xf of op1_Xh
+ { GHC.Ptr.Ptr ipv2_Xi ->
+ case GHC.Prim.<# ww_Xe iendTmp_s27v of {
+ __DEFAULT ->
+ jump exit_Xc ww_Xe eta4_Xg ipv2_Xi;
+ 1# ->
+ case GHC.Prim.indexWord8Array#
+ bx_d22M ww_Xe
+ of r#1_Xk
+ { __DEFAULT ->
+ case GHC.Prim.ltWord8# r#1_Xk 128##8
+ of {
+ __DEFAULT ->
+ case GHC.Prim.writeWord8OffAddr#
+ @GHC.Prim.RealWorld
+ ipv2_Xi
+ 0#
+ r#1_Xk
+ eta4_Xg
+ of s2_a26u
+ { __DEFAULT ->
+ jump $s$wgo1_s2cY
+ s2_a26u
+ (GHC.Prim.plusAddr# ipv2_Xi 1#)
+ (GHC.Prim.+# ww_Xe 1#)
+ };
+ 1# ->
+ case ((ds1_a27N
+ (GHC.Word.W8# r#1_Xk)
+ op1_Xh)
+ `cast` (GHC.Types.N:IO[0]
+ <Ptr Word8>_R
+ :: IO (Ptr Word8)
+ ~R# (GHC.Prim.State#
+ GHC.Prim.RealWorld
+ -> (# GHC.Prim.State#
+ GHC.Prim.RealWorld,
+ Ptr
+ Word8 #))))
+ eta4_Xg
+ of
+ { (# ipv3_Xn, ipv4_Xo #) ->
+ jump $wgo_Xd
+ (GHC.Prim.+# ww_Xe 1#)
+ ipv4_Xo
+ ipv3_Xn
+ }
+ }
+ }
+ }
+ }; } in
+ jump $wgo_Xd
+ (GHC.Prim.+# sc2_s2cL 1#) ipv1_a26M ipv_a26L
+ }
+ }
+ }
+ }; } in
+ jump $s$wgo_s2cO eta3_B3 bx3_d22P bx1_d22N } in
+ case GHC.Prim.<=# ds2_a23R y1_s27t of {
+ __DEFAULT -> jump $j2_s27P y1_s27t;
+ 1# -> jump $j2_s27P ds2_a23R
+ }
+ }
+ } } in
+ case wild3_X6 of {
+ __DEFAULT -> jump $j1_s27p;
+ -1# ->
+ case a_s27n of {
+ __DEFAULT -> jump $j1_s27p;
+ -9223372036854775808# ->
+ case GHC.Real.overflowError of wild6_00 { }
+ }
+ };
+ 0# -> case GHC.Real.divZeroError of wild4_00 { }
+ } } in
+ case GHC.Prim.<=# 4# bx5_a27M of {
+ __DEFAULT -> jump $j_s28Z 4#;
+ 1# -> jump $j_s28Z bx5_a27M
+ }
+ };
+ 1# ->
+ ((k_X2 wild1_X5)
+ `cast` (GHC.Types.N:IO[0] <B.BuildSignal r_a238>_R
+ :: IO (B.BuildSignal r_a238)
+ ~R# (GHC.Prim.State# GHC.Prim.RealWorld
+ -> (# GHC.Prim.State# GHC.Prim.RealWorld,
+ B.BuildSignal r_a238 #))))
+ eta3_B3
+ }
+ }
+ }
+ })
+ `cast` (<BP.BoundedPrim Word8>_R
+ %<'Many>_N ->_R <Text>_R
+ %<'Many>_N ->_R forall (r :: <*>_N).
+ <B.BuildStep (r |> <*>_N)>_R
+ %<'Many>_N ->_R <B.BufferRange>_R
+ %<'Many>_N ->_R Sym (GHC.Types.N:IO[0]
+ <B.BuildSignal (r |> <*>_N)>_R)
+ ; Sym (Data.ByteString.Builder.Internal.N:Builder[0])
+ :: (BP.BoundedPrim Word8
+ -> Text
+ -> forall {r}.
+ B.BuildStep (r |> <*>_N)
+ -> B.BufferRange
+ -> GHC.Prim.State# GHC.Prim.RealWorld
+ -> (# GHC.Prim.State# GHC.Prim.RealWorld,
+ B.BuildSignal (r |> <*>_N) #))
+ ~R# (BP.BoundedPrim Word8 -> Text -> B.Builder))
+
+-- RHS size: {terms: 1, types: 0, coercions: 0, joins: 0/0}
+Data.Text.Encoding.$trModule4 :: GHC.Prim.Addr#
+[GblId,
+ Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True,
+ WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 20 0}]
+Data.Text.Encoding.$trModule4 = "main"#
+
+-- RHS size: {terms: 2, types: 0, coercions: 0, joins: 0/0}
+Data.Text.Encoding.$trModule3 :: GHC.Types.TrName
+[GblId,
+ Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True,
+ WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 10 10}]
+Data.Text.Encoding.$trModule3
+ = GHC.Types.TrNameS Data.Text.Encoding.$trModule4
+
+-- RHS size: {terms: 1, types: 0, coercions: 0, joins: 0/0}
+Data.Text.Encoding.$trModule2 :: GHC.Prim.Addr#
+[GblId,
+ Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True,
+ WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 60 0}]
+Data.Text.Encoding.$trModule2 = "Data.Text.Encoding"#
+
+-- RHS size: {terms: 2, types: 0, coercions: 0, joins: 0/0}
+Data.Text.Encoding.$trModule1 :: GHC.Types.TrName
+[GblId,
+ Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True,
+ WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 10 10}]
+Data.Text.Encoding.$trModule1
+ = GHC.Types.TrNameS Data.Text.Encoding.$trModule2
+
+-- RHS size: {terms: 3, types: 0, coercions: 0, joins: 0/0}
+Data.Text.Encoding.$trModule :: GHC.Types.Module
+[GblId,
+ Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True,
+ WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 10 10}]
+Data.Text.Encoding.$trModule
+ = GHC.Types.Module
+ Data.Text.Encoding.$trModule3 Data.Text.Encoding.$trModule1
+
+
+
diff --git a/testsuite/tests/simplCore/should_compile/all.T b/testsuite/tests/simplCore/should_compile/all.T
index 1450a43932..012150b21e 100644
--- a/testsuite/tests/simplCore/should_compile/all.T
+++ b/testsuite/tests/simplCore/should_compile/all.T
@@ -295,6 +295,7 @@ test('T16348', normal, compile, ['-O'])
test('T16918', normal, compile, ['-O'])
test('T16918a', normal, compile, ['-O'])
test('T16978a', normal, compile, ['-O'])
+test('T21694', [ req_profiling ] , compile, ['-O -prof -fprof-auto -funfolding-use-threshold=50 '])
test('T16978b', normal, compile, ['-O'])
test('T16979a', normal, compile, ['-O'])
test('T16979b', normal, compile, ['-O'])
@@ -420,3 +421,6 @@ test('T21392', [ grep_errmsg(r'sat.* :: \[\(.*Unique, .*Int\)\]'), expect_broken
test('T21689', [extra_files(['T21689a.hs'])], multimod_compile, ['T21689', '-v0 -O'])
test('T21801', normal, compile, ['-O -dcore-lint'])
test('T21848', [grep_errmsg(r'SPEC wombat') ], compile, ['-O -ddump-spec'])
+test('T21694b', [grep_errmsg(r'Arity=4') ], compile, ['-O -ddump-simpl'])
+test('T21960', [grep_errmsg(r'^ Arity=5') ], compile, ['-O2 -ddump-simpl'])
+test('T21948', [grep_errmsg(r'^ Arity=5') ], compile, ['-O -ddump-simpl'])