
On Mon, Jun 11, 2012 at 1:29 PM, Roman Leshchinskiy
Hmm, which version of GHC and what compiler flags are you using? I'm not familiar with ghc-core, maybe that's doing something wrong. Just run ghc -O2 -ddump-simpl and look at the output. Below is the code I'm getting for find_before2 with 7.4.2. As you can see, everything has been fused (although I notice that GHC isn't pushing x_a11p and y1_a124 into the branches for some reason, looks like a new regression but not a particularly bad one and nothing to do with fusion).
I'm using 7.0.3, but I tried with 7.4.2 and it looks like what you got, with only one letrec. So it probably has to do with new optimizations introduced since 7.0. Thanks for the help, and I will use this "count the letrecs" technique in the future if I have questions.