[llvm] r262886 - SelectionDAG: Store SDNode operands in an ArrayRecycler

Justin Bogner via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 7 19:19:25 PST 2016


Justin Bogner via llvm-commits <llvm-commits at lists.llvm.org> writes:
> Author: bogner
> Date: Mon Mar  7 18:39:51 2016
> New Revision: 262886
>
> URL: http://llvm.org/viewvc/llvm-project?rev=262886&view=rev
> Log:
> SelectionDAG: Store SDNode operands in an ArrayRecycler
>
> Currently some SDNode operands are malloc'd, some are stored inline in
> subclasses of SDNode, and some are thrown into a BumpPtrAllocator.
> This scheme is complex, inconsistent, and makes refactoring SDNodes
> fairly difficult.
>
> Instead, we can allocate all of the operands using an ArrayRecycler
> that wraps a BumpPtrAllocator. This keeps the cache locality when
> iterating operands, improves locality when iterating SDNodes without
> looking at operands, and vastly simplifies the ownership semantics.
>
> It also means we stop overallocating SDNodes by 2-3x and will make it
> simpler to fix the rampant undefined behaviour we have in how we
> mutate SDNodes from one kind to another (See llvm.org/pr26808).
>
> This is NFC other than the changes in memory behaviour, and I ran some
> LNT tests to make sure this didn't hurt compile time. Not many tests
> changed: there were a couple of 1-2% regressions reported, but there
> were more improvements (of up to 4%) than regressions.

Reverted this in r262892 and re-applied it in r262902. It was getting
the allocation size needed for the largest SDNode wrong on some 32 bit
platforms, due to some nodes having 8 byte alignment rather than 4
there.


More information about the llvm-commits mailing list