summaryrefslogtreecommitdiff
path: root/include/llvm/GlobalValue.h
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2010-07-28 20:56:48 +0000
committerDan Gohman <gohman@apple.com>2010-07-28 20:56:48 +0000
commit6bbe671e1c58dd58fcf0165c1127dda5037ad3e2 (patch)
tree0b758a76465b6fad8e13cce392747a1ac73556a5 /include/llvm/GlobalValue.h
parent4c010ec85185e2f1d671ac17a387b55228199d5b (diff)
downloadllvm-6bbe671e1c58dd58fcf0165c1127dda5037ad3e2.tar.gz
llvm-6bbe671e1c58dd58fcf0165c1127dda5037ad3e2.tar.bz2
llvm-6bbe671e1c58dd58fcf0165c1127dda5037ad3e2.tar.xz
Make GlobalValue alignment consistent with load, store, and alloca
alignment, fixing silent truncation of alignment values. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@109653 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/GlobalValue.h')
-rw-r--r--include/llvm/GlobalValue.h7
1 files changed, 3 insertions, 4 deletions
diff --git a/include/llvm/GlobalValue.h b/include/llvm/GlobalValue.h
index d175080a66..f4bee85b45 100644
--- a/include/llvm/GlobalValue.h
+++ b/include/llvm/GlobalValue.h
@@ -74,11 +74,10 @@ public:
removeDeadConstantUsers(); // remove any dead constants using this.
}
- unsigned getAlignment() const { return Alignment; }
- void setAlignment(unsigned Align) {
- assert((Align & (Align-1)) == 0 && "Alignment is not a power of 2!");
- Alignment = Align;
+ unsigned getAlignment() const {
+ return (1u << Alignment) >> 1;
}
+ void setAlignment(unsigned Align);
VisibilityTypes getVisibility() const { return VisibilityTypes(Visibility); }
bool hasDefaultVisibility() const { return Visibility == DefaultVisibility; }