summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorReid Kleckner <rnk@google.com>2016-02-26 18:08:59 +0000
committerReid Kleckner <rnk@google.com>2016-02-26 18:08:59 +0000
commit1762ad3e7332f9dc3db942851df3249fb539eed9 (patch)
tree785647966554c270999552ff07fac83cdd3cf583 /llvm/lib
parent334685b486ad15bf5de3098df77372edc9ce2502 (diff)
downloadbcm5719-llvm-1762ad3e7332f9dc3db942851df3249fb539eed9.tar.gz
bcm5719-llvm-1762ad3e7332f9dc3db942851df3249fb539eed9.zip
[IR] Optimize bitfield layout of Value for MSVC
This should save a pointer of padding from all MSVC Value subclasses. Recall that MSVC will not pack the following bitfields together: unsigned Bits : 29; unsigned Flag1 : 1; unsigned Flag2 : 1; unsigned Flag3 : 1; Add a static_assert because LLVM developers always trip over this behavior. This regressed in June. llvm-svn: 262045
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/IR/Value.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/llvm/lib/IR/Value.cpp b/llvm/lib/IR/Value.cpp
index f02c8fdee3b..19fb4f8dba2 100644
--- a/llvm/lib/IR/Value.cpp
+++ b/llvm/lib/IR/Value.cpp
@@ -59,6 +59,8 @@ Value::Value(Type *ty, unsigned scid)
(SubclassID < ConstantFirstVal || SubclassID > ConstantLastVal))
assert((VTy->isFirstClassType() || VTy->isVoidTy()) &&
"Cannot create non-first-class values except for constants!");
+ static_assert(sizeof(Value) == 3 * sizeof(void *) + 2 * sizeof(unsigned),
+ "Value too big");
}
Value::~Value() {
OpenPOWER on IntegriCloud