aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Transforms/Scalar
diff options
context:
space:
mode:
authorChandler Carruth <chandlerc@gmail.com>2012-09-14 10:26:34 +0000
committerChandler Carruth <chandlerc@gmail.com>2012-09-14 10:26:34 +0000
commitb3dd9a13e8454fe069fafc1b259b64851f70e6e7 (patch)
treeb7e273d7781701504a06a60a19b4fd9067a087c6 /lib/Transforms/Scalar
parent63db8bebe6d4792b2d387a8648409fdd12eb498a (diff)
downloadexternal_llvm-b3dd9a13e8454fe069fafc1b259b64851f70e6e7.zip
external_llvm-b3dd9a13e8454fe069fafc1b259b64851f70e6e7.tar.gz
external_llvm-b3dd9a13e8454fe069fafc1b259b64851f70e6e7.tar.bz2
Add two asserts that Duncan thought would help ensure things don't rot
unexpectedly in the future. More fixes from his code review. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@163891 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/Scalar')
-rw-r--r--lib/Transforms/Scalar/SROA.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/Transforms/Scalar/SROA.cpp b/lib/Transforms/Scalar/SROA.cpp
index be7839e..44ffb02 100644
--- a/lib/Transforms/Scalar/SROA.cpp
+++ b/lib/Transforms/Scalar/SROA.cpp
@@ -567,6 +567,7 @@ private:
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 @@ bool SROA::rewriteAllocaPartition(AllocaInst &AI,
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