[llvm-commits] [PATCH] Add an iplist::clearAndLeakNodesUnsafely() function, speed up Recyler:clear()

Michael Ilseman milseman at apple.com
Wed Jan 2 11:50:47 PST 2013


On Jan 2, 2013, at 10:38 AM, Jakob Stoklund Olesen <jolesen at apple.com> wrote:

> Hi,
> 
> I am trying to speed up the ~MachineFunction destructor. We are currently wasting a lot of time and memory bandwidth by pointlessly visiting and changing all the instructions in the function before the BumpPtrAllocator gives its pages back to the OS.
> 
> I am eventually going to make all MachineInstr memory be allocated from the same BumpPtrAllocator so the whole MachineFunction data structure can be taken down by flushing the allocator. This is similar to Apache's memory pools.
> 

Sounds like a cool approach.

> As a first step, I need to convince an iplist to let go of its contents without pulling every object into cache (and dirtying all the cache lines as a bonus!). The clearAndLeakNodesUnsafely() function added in the first patch does that.
> 

I'll let others talk about design and purity, but I think the functionality you have is very useful for other users of ilist who want to have a constant-time clear when they can guarantee cleanup.

> Second, specialize Recycler::clear(BumpPtrAllocator) to avoid doing the same thing with the free list.
> 

Looks like an obvious user of the functionality :-)

> Please review!
> 
> /jakob
> 
> 
> <0001-Add-an-iplist-clearAndLeakNodesUnsafely-function.patch><0002-Special-case-Recycler-clear-BumpPtrAllocator.patch>_______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits




More information about the llvm-commits mailing list