logo       

Re: [GHC] #683: RULES for recursive functions don't work properly: msg#00119

lang.haskell.glasgow.bugs

Subject: Re: [GHC] #683: RULES for recursive functions don't work properly

#683: RULES for recursive functions don't work properly
-----------------------+----------------------------------------------------
Reporter: simonpj | Owner: simonpj
Type: bug | Status: new
Priority: low | Milestone:
Component: Compiler | Version: 6.4.1
Severity: normal | Resolution:
Keywords: | Os: Unknown
Difficulty: Unknown | Architecture: Unknown
-----------------------+----------------------------------------------------
Comment (by simonpj):

Before I forget, here's the beginning of a modification to address the
original problem. It's not implemented, but I thought I'd leave the notes
here in case it pops up as an issue again.
{{{
hunk ./compiler/basicTypes/BasicTypes.lhs 329
+
+Note [RulesOnly]
+~~~~~~~~~~~~~~~~
+The RulesOnly boolean is True if the only reason the Id is a
+loop-breaker only because of recursion through a RULE. In that case,
+we can ignore the loop-breaker-ness for inlining purposes. Example
+(from GHC.Enum):
+
+ eftInt :: Int# -> Int# -> [Int]
+ eftInt x y = ...(non-recursive)...
+
+ {-# INLINE [0] eftIntFB #-}
+ eftIntFB :: (Int -> r -> r) -> r -> Int# -> Int# -> r
+ eftIntFB c n x y = ...(non-recursive)...
+
+ {-# RULES
+ "eftInt" [~1] forall x y. eftInt x y = build (\ c n -> eftIntFB c n x
y)
+ "eftIntList" [1] eftIntFB (:) [] = eftInt
+ #-}
+
+The two look mutually recursive only because of their RULES;
+we don't want that to inhibit inlining!
+
hunk ./compiler/basicTypes/BasicTypes.lhs 364
- -- in a group of recursive definitions
+ !RulesOnly -- in a group of recursive definitions
+[_^I_][_^I_][_^I_][_$_]
+
+type RulesOnly = Bool -- See Note [RulesOnly]
}}}

--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/683>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler_______________________________________________
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@xxxxxxxxxxx
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise