[llvm-commits] [PATCH] SmallVector specialization

Chris Lattner clattner at apple.com
Wed Feb 15 20:27:16 PST 2012


On Feb 15, 2012, at 8:18 PM, Peter Cooper wrote:

> Hi all
> 
> Please review this patch to specialize SmallVector::push_back based on whether the type is POD.  Basically i'm avoiding the call to placement new which was creating null checks on the pointer.  As we know the pointer is never null here this should be safe.
> 
> Removal of these null checks allows far more optimization in the common case where we constructed a SmallVector then immediately pushed back into it.  The clang executable on x86_64 darwin Release+Asserts goes from 35373352 to 35181016 bytes, a reduction of 188KB.

Wow, that's a great result - please commit.  Independent of this patch, can you file an optimizer bugzilla about this?  I think the optimizer should be able to eliminate the null check if it is smarter, though I admit that I haven't looked at the IR.

-Chris



More information about the llvm-commits mailing list