Force GC calls out of the straight line execution path

Ömer Sinan Ağacan omeragacan at
Mon Jun 13 12:34:40 UTC 2016

Hi Harendra,

Would it be possible for you to provide a minimal example that compiles to such
assembly? It's hard to tell if this is an easy case.

Also, just to make sure, you're using -O, right? (I'm not sure if we have a
related transformation enabled with -O but just to make sure...)

2016-06-13 7:23 GMT-04:00 Harendra Kumar <harendra.kumar at>:
> Hi,
> I noticed in the generated code (llvm as well as native) that in some cases
> the GC calls are in the straight path and the regular code is out of the
> straight line path. Like this:
> => 0x408fc0:  lea    0x30(%r12),%rax
> => 0x408fc5:  cmp    0x358(%r13),%rax
> => 0x408fcc:  jbe    0x408fe9                   # notice jbe instead of ja
> i.e. branch taken in normal case
> I tried to count in how many cases its happening in my executable and found
> that its only a small percentage (4-6%) of cases but those cases include the
> code which runs 99% of the time in my benchmark. Though it does not make a
> whole lot of difference but the difference is perceptible and especially
> when it is in a tight loop.
> Is it possible to somehow force all the GC calls out of the line during code
> generation? Has it been thought/discussed before?
> -harendra
> _______________________________________________
> ghc-devs mailing list
> ghc-devs at

More information about the ghc-devs mailing list