summaryrefslogtreecommitdiffstats
path: root/llvm/unittests/Transforms/IPO/LowerBitSets.cpp
diff options
context:
space:
mode:
authorPeter Collingbourne <peter@pcc.me.uk>2015-02-25 20:42:41 +0000
committerPeter Collingbourne <peter@pcc.me.uk>2015-02-25 20:42:41 +0000
commiteba7f73ff953c4b8d4e26abbc9d4e76142b8fb8c (patch)
tree4838b6258e3bbfa686e093526239a2cdfc058a81 /llvm/unittests/Transforms/IPO/LowerBitSets.cpp
parent66bc9080d6d5ef4904f25d70c374a3dc2c218c9f (diff)
downloadbcm5719-llvm-eba7f73ff953c4b8d4e26abbc9d4e76142b8fb8c.tar.gz
bcm5719-llvm-eba7f73ff953c4b8d4e26abbc9d4e76142b8fb8c.zip
LowerBitSets: Align referenced globals.
This change aligns globals to the next highest power of 2 bytes, up to a maximum of 128. This makes it more likely that we will be able to compress bit sets with a greater alignment. In many more cases, we can now take advantage of a new optimization also introduced in this patch that removes bit set checks if the bit set is all ones. The 128 byte maximum was found to provide the best tradeoff between instruction overhead and data overhead in a recent build of Chromium. It allows us to remove ~2.4MB of instructions at the cost of ~250KB of data. Differential Revision: http://reviews.llvm.org/D7873 llvm-svn: 230540
Diffstat (limited to 'llvm/unittests/Transforms/IPO/LowerBitSets.cpp')
-rw-r--r--llvm/unittests/Transforms/IPO/LowerBitSets.cpp28
1 files changed, 16 insertions, 12 deletions
diff --git a/llvm/unittests/Transforms/IPO/LowerBitSets.cpp b/llvm/unittests/Transforms/IPO/LowerBitSets.cpp
index 2f27c0762ff..26a42528378 100644
--- a/llvm/unittests/Transforms/IPO/LowerBitSets.cpp
+++ b/llvm/unittests/Transforms/IPO/LowerBitSets.cpp
@@ -20,19 +20,22 @@ TEST(LowerBitSets, BitSetBuilder) {
uint64_t BitSize;
unsigned AlignLog2;
bool IsSingleOffset;
+ bool IsAllOnes;
} BSBTests[] = {
- {{}, {0}, 0, 1, 0, false},
- {{0}, {1}, 0, 1, 0, true},
- {{4}, {1}, 4, 1, 0, true},
- {{37}, {1}, 37, 1, 0, true},
- {{0, 1}, {3}, 0, 2, 0, false},
- {{0, 4}, {3}, 0, 2, 2, false},
- {{0, uint64_t(1) << 33}, {3}, 0, 2, 33, false},
- {{3, 7}, {3}, 3, 2, 2, false},
- {{0, 1, 7}, {131}, 0, 8, 0, false},
- {{0, 2, 14}, {131}, 0, 8, 1, false},
- {{0, 1, 8}, {3, 1}, 0, 9, 0, false},
- {{0, 2, 16}, {3, 1}, 0, 9, 1, false},
+ {{}, {0}, 0, 1, 0, false, false},
+ {{0}, {1}, 0, 1, 0, true, true},
+ {{4}, {1}, 4, 1, 0, true, true},
+ {{37}, {1}, 37, 1, 0, true, true},
+ {{0, 1}, {3}, 0, 2, 0, false, true},
+ {{0, 4}, {3}, 0, 2, 2, false, true},
+ {{0, uint64_t(1) << 33}, {3}, 0, 2, 33, false, true},
+ {{3, 7}, {3}, 3, 2, 2, false, true},
+ {{0, 1, 7}, {131}, 0, 8, 0, false, false},
+ {{0, 2, 14}, {131}, 0, 8, 1, false, false},
+ {{0, 1, 8}, {3, 1}, 0, 9, 0, false, false},
+ {{0, 2, 16}, {3, 1}, 0, 9, 1, false, false},
+ {{0, 1, 2, 3, 4, 5, 6, 7}, {255}, 0, 8, 0, false, true},
+ {{0, 1, 2, 3, 4, 5, 6, 7, 8}, {255, 1}, 0, 9, 0, false, true},
};
for (auto &&T : BSBTests) {
@@ -47,6 +50,7 @@ TEST(LowerBitSets, BitSetBuilder) {
EXPECT_EQ(T.BitSize, BSI.BitSize);
EXPECT_EQ(T.AlignLog2, BSI.AlignLog2);
EXPECT_EQ(T.IsSingleOffset, BSI.isSingleOffset());
+ EXPECT_EQ(T.IsAllOnes, BSI.isAllOnes());
for (auto Offset : T.Offsets)
EXPECT_TRUE(BSI.containsGlobalOffset(Offset));
OpenPOWER on IntegriCloud