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

Jay Foad jay.foad at gmail.com
Tue Mar 29 01:25:07 PDT 2011


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.

Thanks,
Jay.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: call-reserveoperandspace.diff
Type: text/x-patch
Size: 25069 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20110329/14298c20/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: remove-reserveoperandspace.diff
Type: text/x-patch
Size: 50863 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20110329/14298c20/attachment-0001.bin>


More information about the cfe-commits mailing list