
#14068: Loopification using join points
-------------------------------------+-------------------------------------
Reporter: nomeata | Owner: nomeata
Type: bug | Status: new
Priority: normal | Milestone:
Component: Compiler | Version: 8.0.1
Resolution: | Keywords: JoinPoints
Operating System: Unknown/Multiple | Architecture:
| Unknown/Multiple
Type of failure: None/Unknown | Test Case:
Blocked By: | Blocking:
Related Tickets: #13966 #14067 | Differential Rev(s): Phab:D3811
#14827 |
Wiki Page: |
-------------------------------------+-------------------------------------
Comment (by kavon):
Here are the details on FloatOut: Using `wip/T14068-inline`, I compiled
`queens` with `-O2 -ddump-occur-anal -ddump-simpl-iterations -ddump-call-
arity -dverbose-core2core` to watch every Core transformation, and noticed
that after Specialize, we have nicely inlined the "safe" loop
(`safe_s5vS`) into the folding function:
{{{
... inside gen ...
GHC.Base.foldr
@ [Int]
@ a_d3jr
(\ (ds_d3jv :: [Int]) (ds_d3ju [OS=OneShot] :: a_d3jr) ->
GHC.Base.foldr
@ Int
@ a_d3jr
(\ (ds_d3jx :: Int)
(ds_d3jw [OS=OneShot] :: a_d3jr) ->
case joinrec {
safe_s5vS [Occ=LoopBreaker]
:: Int -> Int -> [Int] -> Bool
[LclId[JoinId(3)], Arity=3]
safe_s5vS (x_X14P :: Int)
(d_X14R :: Int)
(ds_X3kg :: [Int])
= ... BODY OF SAFE ... } in
jump safe_s5vS
ds_d3jx (GHC.Types.I# 1#) ds_d3jv
of {
False -> ds_d3jw;
True ->
c_d3js
(GHC.Types.: @ Int ds_d3jx ds_d3jv) ds_d3jw
})
}}}
Right after Specialize, SetLevels tells FloatOut to move that join point
to the top level:
{{{
GHC.Base.foldr
@ [GHC.Types.Int]
@ a_d3jr
(\