aboutsummaryrefslogtreecommitdiffstats
path: root/lib/VMCore
diff options
context:
space:
mode:
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!");
}