summaryrefslogtreecommitdiff
path: root/lib/IR
diff options
context:
space:
mode:
authorBjorn Steinbrink <bsteinbr@gmail.com>2017-12-17 15:16:58 +0000
committerBjorn Steinbrink <bsteinbr@gmail.com>2017-12-17 15:16:58 +0000
commitce542fd0ceb5d1c9485088e166de69558cb23127 (patch)
treeae5960fae2d573d155702d76d4fdd305352e2b3c /lib/IR
parent7bf95b403d57c44090597bb450a43de8700fff4c (diff)
Revert "Properly handle multi-element and dynamically sized allocas in getPointerDereferenceableBytes()"
This reverts commit 217067d5179882de9deb60d2e866befea4c126e7. Fails on llvm-clang-x86_64-expensive-checks-win git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@320945 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/IR')
-rw-r--r--lib/IR/Value.cpp10
1 files changed, 4 insertions, 6 deletions
diff --git a/lib/IR/Value.cpp b/lib/IR/Value.cpp
index eae697b2e4b..773ed89db04 100644
--- a/lib/IR/Value.cpp
+++ b/lib/IR/Value.cpp
@@ -619,11 +619,11 @@ const Value *Value::stripInBoundsOffsets() const {
return stripPointerCastsAndOffsets<PSK_InBounds>(this);
}
-uint64_t Value::getPointerDereferenceableBytes(const DataLayout &DL,
+unsigned Value::getPointerDereferenceableBytes(const DataLayout &DL,
bool &CanBeNull) const {
assert(getType()->isPointerTy() && "must be pointer");
- uint64_t DerefBytes = 0;
+ unsigned DerefBytes = 0;
CanBeNull = false;
if (const Argument *A = dyn_cast<Argument>(this)) {
DerefBytes = A->getDereferenceableBytes();
@@ -655,10 +655,8 @@ uint64_t Value::getPointerDereferenceableBytes(const DataLayout &DL,
CanBeNull = true;
}
} else if (auto *AI = dyn_cast<AllocaInst>(this)) {
- const ConstantInt *ArraySize = dyn_cast<ConstantInt>(AI->getArraySize());
- if (ArraySize && AI->getAllocatedType()->isSized()) {
- DerefBytes = DL.getTypeStoreSize(AI->getAllocatedType()) *
- ArraySize->getZExtValue();
+ if (AI->getAllocatedType()->isSized()) {
+ DerefBytes = DL.getTypeStoreSize(AI->getAllocatedType());
CanBeNull = false;
}
} else if (auto *GV = dyn_cast<GlobalVariable>(this)) {