[llvm-commits] CVS: llvm/lib/VMCore/Instructions.cpp

Chris Lattner lattner at cs.uiuc.edu
Sat Nov 5 13:58:05 PST 2005



Changes in directory llvm/lib/VMCore:

Instructions.cpp updated: 1.27 -> 1.28
---
Log message:

verify that alignments are always a power of 2


---
Diffs of the changes:  (+2 -0)

 Instructions.cpp |    2 ++
 1 files changed, 2 insertions(+)


Index: llvm/lib/VMCore/Instructions.cpp
diff -u llvm/lib/VMCore/Instructions.cpp:1.27 llvm/lib/VMCore/Instructions.cpp:1.28
--- llvm/lib/VMCore/Instructions.cpp:1.27	Sat Nov  5 03:21:28 2005
+++ llvm/lib/VMCore/Instructions.cpp	Sat Nov  5 15:57:54 2005
@@ -498,6 +498,7 @@
                                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 @@
                                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!");
 }
 






More information about the llvm-commits mailing list