[llvm-commits] [PATCH 0/5] Reduce memory usage for phi operands
Chris Lattner
clattner at apple.com
Fri Jun 17 21:59:06 PDT 2011
On Jun 16, 2011, at 4:09 AM, Jay Foad wrote:
>
> Currently, a PHINode has 2 * n operands laid out like this:
>
> VAL0, BB0, VAL1, BB1, ..., VALn-1, BBn-1
>
> Chris suggested to me that the BBn operands don't need to be full-blown Uses; they can just be pointers to the BasicBlock. This should be a win because:
>
> - Uses are bulky and slow to access
> - This keeps phi nodes off BasicBlocks' use lists, which should make it faster to enumerate a BasicBlock's predecessors.
>
> The following patches implement this suggestion. PHINodes now have n operands, immediately followed in memory by n pointers to basic blocks, like this:
>
> VAL0, VAL1, ..., VALn-1; bb0, bb1, ..., bbn-1
>
>
> I used "valgrind --tool=massif --peak-inaccuracy=0" to measure peak heap memory usage before and after my changes, for the following commands (using source from MultiSource/Applications/sqlite3/):
This patch series looks fantastic to me, please commit Jay. A 1.7% speedup is pretty great! Thanks for tackling this.
If you're interested in another project, PR1324 would be another great memory reduction for apps with lots of strings and tables.
-Chris
More information about the llvm-commits
mailing list