Questions concerning the LLVM backend - i.e. 'proc point splitting'

David Spitzenberg spitzenb at
Thu Nov 12 16:25:15 UTC 2015

Hello everybody,

I've got some questions concerning the LLVM backend - i.e. the pass
'proc point splitting' in the cmm-pipeline.

I'm new to this list as well as to computer science in general - at
least in some sense. Being a third semester student of computer science,
I'm not quite sure, whether I'm addressing the right list with this
mail. Feel free to correct me, if not.

I'm doing numerical stencil calculations which heavily depend on nested
loops expressed as tail-recursive functions nested one in another. When
compiling a module, GHC seems capable of emitting pretty good cmm-code.
At least as long as the loop bodies do not contain any call to
non-inlineable functions. In most cases 'loopification' fires and
transforms tail-recursive calls into loops.

When calling into non-inlineable functions, 'proc point splitting' is
performed. This splits the loops into several mutually-recursive
functions therefore significantly decreasing the possibilities of 'opt'
in optimizing the code later on. This leads to pretty bad performance of
the whole calculation.

To avoid the presence of proc points within a loop body - and by doing
so the splitting of the body - I currently try to avoid calls into
non-inlineable functions by merging the nested recursive functions into
one giant tail-recursive function. This works, as long as everything not
defined in the module being compiled can be inlined. Apparently, this is
not a long term solution.

My questions:

 - The reason to perform 'proc point splitting' is, that LLVM IR lacks
of the possibility to call into an arbitrary basic block of a function
body from outside the function itself. Is this understanding right?

 - Are there any other possibilities to avoid 'proc point splitting'
when using LLVM as a backend?

 - I recently read the article on an improved LLVM backend in the GHC
wiki (, but
couldn't find any suggestions on the topic of 'proc point splitting'.
Are there any plans to solve the problem either by teaching LLVM IR the
lacking functionality or in any other way?

I'd really like to contribute to GHC by working on this problem, but I'm
not quite sure, if I'm capable of doing so. My background knowledge is
still somewhat limited, but I'm working on it ;-)

Thanks in advance for your help!


David Spitzenberg

PS.: Thanks to everyone for the great work you're doing on GHC!

More information about the ghc-devs mailing list