aboutsummaryrefslogtreecommitdiffstats
path: root/lib/VMCore
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2005-11-05 21:57:54 +0000
committerChris Lattner <sabre@nondot.org>2005-11-05 21:57:54 +0000
commit6033716140c18887174d3371ef7c9a840e001a24 (patch)
treeca1d802388d514739c90b74bb226f9e012f107ba /lib/VMCore
parentd91c32110abce9f9b082d52d5668c003c40e5994 (diff)
downloadexternal_llvm-6033716140c18887174d3371ef7c9a840e001a24.zip
external_llvm-6033716140c18887174d3371ef7c9a840e001a24.tar.gz
external_llvm-6033716140c18887174d3371ef7c9a840e001a24.tar.bz2
verify that alignments are always a power of 2
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@24200 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/VMCore')
-rw-r--r--lib/VMCore/Instructions.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/VMCore/Instructions.cpp b/lib/VMCore/Instructions.cpp
index 96a010b..48f3ed0 100644
--- a/lib/VMCore/Instructions.cpp
+++ b/lib/VMCore/Instructions.cpp
@@ -498,6 +498,7 @@ AllocationInst::AllocationInst(const Type *Ty, Value *ArraySize, unsigned iTy,
Instruction *InsertBefore)
: UnaryInstruction(PointerType::get(Ty), iTy, getAISize(ArraySize),
Name, InsertBefore), Alignment(Align) {
+ assert((Align & (Align-1)) == 0 && "Alignment is not a power of 2!");
assert(Ty != Type::VoidTy && "Cannot allocate void!");
}
@@ -506,6 +507,7 @@ AllocationInst::AllocationInst(const Type *Ty, Value *ArraySize, unsigned iTy,
BasicBlock *InsertAtEnd)
: UnaryInstruction(PointerType::get(Ty), iTy, getAISize(ArraySize),
Name, InsertAtEnd), Alignment(Align) {
+ assert((Align & (Align-1)) == 0 && "Alignment is not a power of 2!");
assert(Ty != Type::VoidTy && "Cannot allocate void!");
}