[LLVMdev] Question about SmallVector implementation detail

bombela bombela at gmail.com
Sun Jul 4 00:04:09 PDT 2010


I have just a little question about the SmallVector implemention.

In SmallVectorImpl, the following method is currently implemented as:

  void push_back(const T &Elt) {
    if (this->EndX < this->CapacityX) {
      new (this->end()) T(Elt);
    goto Retry;

~/llvm-project/llvm/include/llvm/ADT/SmallVector.h:327 (svn rev: 107560)
This function was wrote/last modified by lattner.

Why a goto?
For CPU branch prediction in favor of the positive condition result?
I'am interested by the reason of that, that's look curious for me.

Thank you,
Best regards,
François-Xavier Bourlet
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20100704/7beba0c8/attachment.html>

More information about the llvm-dev mailing list