summaryrefslogtreecommitdiff
path: root/testsuite/tests/ghc-regress/simplCore/should_compile/T4957.hs
blob: 63086cd78d0ffb397babf083eb06a430d29ac063 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
{-# LANGUAGE MagicHash #-}
module T4957 where

import GHC.Base

f :: Bool -> Int -> Int
f b 0 = 0
f b x = let y = case b of
                 True -> case f b (x-1) of
                            I# v -> I# (v -# 1#)
                 False -> case f b (x-1) of
                            I# v -> I# (v +# 1#)
      in
      case b of
         True -> case y of
                   I# w -> I# (w -# 1#)

         False -> case y of
                   I# w -> I# (w +# 1#)