[llvm-commits] [PATCH] remove PHINode::reserveOperandSpace()

Chris Lattner clattner at apple.com
Tue Mar 29 13:58:54 PDT 2011


On Mar 29, 2011, at 1:25 AM, Jay Foad wrote:

> I noticed that:
> 
> - All calls to PHINode::reserveOperandSpace() are on newly created PHINodes.
> - Most places that create a PHINode immediately call
> reserveOperandSpace(), to reserve space for the (known or expected)
> number of operands.
> - Those that don't, probably should.
> 
> These patches enforce and simplify this by making the number of
> operands an argument to PHINode::Create(), and removing the
> reserveOperandSpace() method altogether.
> 
> The patches are:
> 
> 1. (Almost) always call reserveOperandSpace() on newly created PHINodes.
> 2. Add parameter to PHINode::Create() and remove PHINode::reserveOperandSpace().
> 
> Tested with "make check", LLVM and Clang. OK to apply?
> 
> My motivation for working on this is that it removes one caller of
> PHINode::resizeOperands(), which in turn should allow some
> simplification of that function.

Sounds great!

-Chris




More information about the llvm-commits mailing list