diff options
author | Benjamin Kramer <benny.kra@googlemail.com> | 2013-07-11 15:37:27 +0000 |
---|---|---|
committer | Benjamin Kramer <benny.kra@googlemail.com> | 2013-07-11 15:37:27 +0000 |
commit | cce97be70b1e0ebbf0d84f1a45372c6f1e316ca0 (patch) | |
tree | 1aed75b5ece5bf0055351374b8f775dc797947b8 /llvm/lib | |
parent | b1c1c5f37734770f7ecef3d83f26e130ca4a4c9e (diff) | |
download | bcm5719-llvm-cce97be70b1e0ebbf0d84f1a45372c6f1e316ca0.tar.gz bcm5719-llvm-cce97be70b1e0ebbf0d84f1a45372c6f1e316ca0.zip |
Use move semantics if possible to construct ConstantRanges.
Arithmetic on ConstantRanges creates a lot of large temporary APInts that
benefit from move semantics.
llvm-svn: 186091
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/Support/ConstantRange.cpp | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/llvm/lib/Support/ConstantRange.cpp b/llvm/lib/Support/ConstantRange.cpp index 5c5895026b6..d770381dcd5 100644 --- a/llvm/lib/Support/ConstantRange.cpp +++ b/llvm/lib/Support/ConstantRange.cpp @@ -38,13 +38,14 @@ ConstantRange::ConstantRange(uint32_t BitWidth, bool Full) { /// Initialize a range to hold the single specified value. /// -ConstantRange::ConstantRange(const APInt &V) : Lower(V), Upper(V + 1) {} +ConstantRange::ConstantRange(APIntMoveTy V) + : Lower(llvm_move(V)), Upper(Lower + 1) {} -ConstantRange::ConstantRange(const APInt &L, const APInt &U) : - Lower(L), Upper(U) { - assert(L.getBitWidth() == U.getBitWidth() && +ConstantRange::ConstantRange(APIntMoveTy L, APIntMoveTy U) + : Lower(llvm_move(L)), Upper(llvm_move(U)) { + assert(Lower.getBitWidth() == Upper.getBitWidth() && "ConstantRange with unequal bit widths"); - assert((L != U || (L.isMaxValue() || L.isMinValue())) && + assert((Lower != Upper || (Lower.isMaxValue() || Lower.isMinValue())) && "Lower == Upper, but they aren't min or max value!"); } |