[llvm-commits] [llvm] r163891 - /llvm/trunk/lib/Transforms/Scalar/SROA.cpp

Chandler Carruth chandlerc at gmail.com
Fri Sep 14 03:26:35 PDT 2012


Author: chandlerc
Date: Fri Sep 14 05:26:34 2012
New Revision: 163891

URL: http://llvm.org/viewvc/llvm-project?rev=163891&view=rev
Log:
Add two asserts that Duncan thought would help ensure things don't rot
unexpectedly in the future. More fixes from his code review.

Modified:
    llvm/trunk/lib/Transforms/Scalar/SROA.cpp

Modified: llvm/trunk/lib/Transforms/Scalar/SROA.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/SROA.cpp?rev=163891&r1=163890&r2=163891&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/SROA.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/SROA.cpp Fri Sep 14 05:26:34 2012
@@ -567,6 +567,7 @@
 
 
   bool visitMemSetInst(MemSetInst &II) {
+    assert(II.getRawDest() == *U && "Pointer use is not the destination?");
     ConstantInt *Length = dyn_cast<ConstantInt>(II.getLength());
     insertUse(II, Length ? Length->getZExtValue() : AllocSize - Offset, Length);
     return true;
@@ -2440,6 +2441,7 @@
     AllocaTy = Type::getIntNTy(*C, AllocaSize * 8);
   if (!AllocaTy)
     AllocaTy = ArrayType::get(Type::getInt8Ty(*C), AllocaSize);
+  assert(TD->getTypeAllocSize(AllocaTy) >= AllocaSize);
 
   // Check for the case where we're going to rewrite to a new alloca of the
   // exact same type as the original, and with the same access offsets. In that





More information about the llvm-commits mailing list