[llvm-commits] [PATCH] don't allocate useless PHI operands

Chris Lattner clattner at apple.com
Sat Apr 9 14:32:33 PDT 2011


On Mar 30, 2011, at 4:18 AM, Jay Foad wrote:

> PHINode::resizeOperands(0) "grows the number of ops by 1.5 times".
> This sometimes allocates an odd number of operands, which is wasteful
> because PHI nodes only ever use an even number of operands. The
> attached patch fixes this so that we only ever allocate an even number
> of operands.
> 
> The savings are pretty tiny. My test case was to compile sqlite3.c
> from the LLVM testsuite with "clang -cc1 -emit-llvm-bc -O3" on
> Linux/x86_64. valgrind --tool=massif shows that the peak memory usage
> is 81.9 MB, of which 1.17 MB is allocated in User::allocHungoffUses().
> This patch reduces those figures by 6.49 KB, about 0.008% of the total
> memory usage or 0.5% of that allocated in User::allocHungoffUses().

Sure, this looks good to me, thanks Jay.

-Chris



More information about the llvm-commits mailing list