mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-01-31 20:51:52 +01:00
Make APInt negate just do a 2's complement negate instead of subtract. NFC.
This is part of an effort to shave allocations from APInt heavy paths. I'll be moving many of the other operators to r-value references soon and this is a step towards doing that without too much duplication. Saves 15k allocations when doing 'opt -O2 verify-uselistorder.bc'. llvm-svn: 271556
This commit is contained in:
parent
5a2d283ab8
commit
850888b791
@ -625,7 +625,12 @@ public:
|
||||
/// Negates *this using two's complement logic.
|
||||
///
|
||||
/// \returns An APInt value representing the negation of *this.
|
||||
APInt operator-() const { return APInt(BitWidth, 0) - (*this); }
|
||||
APInt operator-() const {
|
||||
APInt Result(*this);
|
||||
Result.flipAllBits();
|
||||
++Result;
|
||||
return Result;
|
||||
}
|
||||
|
||||
/// \brief Logical negation operator.
|
||||
///
|
||||
|
Loading…
x
Reference in New Issue
Block a user