summaryrefslogtreecommitdiffstats
path: root/llvm/lib/VMCore/Instructions.cpp
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
commit79b8c792423ef9dbd8b7797e160625088ffbcab6 (patch)
tree8d0dd1614dbdf28c8be875497663c7608e409992 /llvm/lib/VMCore/Instructions.cpp
parentb467a4fb2982c4702c1bfdcb1355493fef4db907 (diff)
downloadbcm5719-llvm-79b8c792423ef9dbd8b7797e160625088ffbcab6.tar.gz
bcm5719-llvm-79b8c792423ef9dbd8b7797e160625088ffbcab6.zip
verify that alignments are always a power of 2
llvm-svn: 24200
Diffstat (limited to 'llvm/lib/VMCore/Instructions.cpp')
-rw-r--r--llvm/lib/VMCore/Instructions.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/llvm/lib/VMCore/Instructions.cpp b/llvm/lib/VMCore/Instructions.cpp
index 96a010b2f77..48f3ed0e5f3 100644
--- a/llvm/lib/VMCore/Instructions.cpp
+++ b/llvm/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!");
}
OpenPOWER on IntegriCloud