malloc() vs. MallocInst


I recently looked quite some time for why poolalloc wouldn't transform calls
to malloc() in my program, until I noticed that it handles calls to malloc()
(eg, stdlib pass) -- but only transforms MallocInst's.

Is there a general policy on how passes should behave? Should they handle both
representations, is doing -raiseallocs the preferred way, or do we
explicitely not want any single policy (ie, are there any hidden problems)?
Perhaps this could also get a FAQ entry or sth. like that.


Generally passes should assume that they are operating on a canonical form of the program if some other pass provides that. In this case, because raiseallocs transforms malloc calls into malloc instructions, it is very reasonable for poolalloc to assume everything is using the instruction form.

Likewise, DSA and poolalloc will be significantly less precise and useful if you run it on a .bc file that has not yet been optimized.



For what are you interested in poolalloc? I'm asking because we are trying to decide how to prioritize work on it. Thanks,


Hi Vikram,

I want to use poolalloc as a means for partitioning memory in Software
Transactional Memory. We will have a paper about tuning parameters in
word-based STMs in PPoPP 08, but there we use one configuration for the
complete TM, which obviously has limitations in heterogenous workloads.

Partitioning with poolalloc should give me (1) hopefully meaningful partitions
(ie, datastructures) with locality without requiring user annotations, (2)
spatial locality that can make runtime partition lookup easier (eg, table
entries per page), and (3) type-information for pools. I already mentioned
partitioning briefly in one of our previous conversations (and you pointed
out the usefulness of poolalloc for partitioning :), but I was too busy
during the summer to really work on this. I was initially aiming for a not
far away deadline, but I'm behind schedule so I'll have to see how fast I can

The only issues that poolalloc has for me right now is that (a) passing things
through pthread_create() doesn't work out of the box and (b) node collapsing
when I enable llvm-ld optimizations. I guess I can do sth. about (a) (I've
been already talking about this with Andrew), and (b) is not critical either.

I've seen that you too have a PPoPP paper, congratulations. Is it related (or
could I get a (draft) copy)?
Which kinds of work do you have to prioritize, if I may ask? Perhaps I can
then give you better input. Eg, (a) could be useful for poolalloc (although
my solutions could be too TM specific).
If there should be an overlap in research interests and we could collaborate,
that would be great as well.

Thanks for the support,


I'm sorry for the spam, my mail program is too clever for me.