aboutsummaryrefslogtreecommitdiff
path: root/llvm/unittests/ADT/BitVectorTest.cpp
diff options
context:
space:
mode:
authorJakob Stoklund Olesen <stoklund@2pi.dk>2012-05-14 15:46:27 +0000
committerJakob Stoklund Olesen <stoklund@2pi.dk>2012-05-14 15:46:27 +0000
commit77e7b8ede2b87b0be45bc034c0bdde5e299452e9 (patch)
tree4a473568d58bccf6c552953d4e5c0dc2077dd4f2 /llvm/unittests/ADT/BitVectorTest.cpp
parent76680e9b4ec9e0ed019791373b726364e15dc322 (diff)
downloadllvm-77e7b8ede2b87b0be45bc034c0bdde5e299452e9.zip
llvm-77e7b8ede2b87b0be45bc034c0bdde5e299452e9.tar.gz
llvm-77e7b8ede2b87b0be45bc034c0bdde5e299452e9.tar.bz2
Remove the expensive BitVector::operator~().
Returning a temporary BitVector is very expensive. If you must, create the temporary explicitly: Use BitVector(A).flip() instead of ~A. llvm-svn: 156768
Diffstat (limited to 'llvm/unittests/ADT/BitVectorTest.cpp')
-rw-r--r--llvm/unittests/ADT/BitVectorTest.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/llvm/unittests/ADT/BitVectorTest.cpp b/llvm/unittests/ADT/BitVectorTest.cpp
index 24ce3dd..62aadf6 100644
--- a/llvm/unittests/ADT/BitVectorTest.cpp
+++ b/llvm/unittests/ADT/BitVectorTest.cpp
@@ -42,7 +42,8 @@ TEST(BitVectorTest, TrivialOperation) {
EXPECT_FALSE(Vec.none());
EXPECT_FALSE(Vec.empty());
- BitVector Inv = ~Vec;
+ BitVector Inv = Vec;
+ Inv.flip();
EXPECT_EQ(6U, Inv.count());
EXPECT_EQ(11U, Inv.size());
EXPECT_TRUE(Inv.any());
@@ -52,7 +53,7 @@ TEST(BitVectorTest, TrivialOperation) {
EXPECT_FALSE(Inv == Vec);
EXPECT_TRUE(Inv != Vec);
- Vec = ~Vec;
+ Vec.flip();
EXPECT_TRUE(Inv == Vec);
EXPECT_FALSE(Inv != Vec);
@@ -131,7 +132,7 @@ TEST(BitVectorTest, TrivialOperation) {
EXPECT_TRUE(Vec.none());
EXPECT_FALSE(Vec.empty());
- Inv = ~BitVector();
+ Inv = BitVector().flip();
EXPECT_EQ(0U, Inv.count());
EXPECT_EQ(0U, Inv.size());
EXPECT_FALSE(Inv.any());