Use RValue refs in APInt add/sub methods.
authorPete Cooper <peter_cooper@apple.com>
Fri, 22 Jul 2016 20:55:46 +0000 (20:55 +0000)
committerPete Cooper <peter_cooper@apple.com>
Fri, 22 Jul 2016 20:55:46 +0000 (20:55 +0000)
commitfea2139740e94953749b030b8c1e5b75f9a308b4
treee7d9ffbcdd740bc4465a41ce14d4d841e1e24f96
parent462a5328ddd6ee7612911ea6f91da40ed3d994f4
Use RValue refs in APInt add/sub methods.

This adds versions of operator + and - which are optimized for the LHS/RHS of the
operator being RValue's.  When an RValue is available, we can use its storage space
instead of allocating new space.

On code such as ConstantRange which makes heavy use of APInt's over 64-bits in size,
this results in significant numbers of saved allocations.

Thanks to David Blaikie for all the review and most of the code here.

llvm-svn: 276470
llvm/include/llvm/ADT/APInt.h
llvm/lib/Support/APInt.cpp
llvm/unittests/ADT/APIntTest.cpp