[PATCH] D41398: Give up on array allocas in getPointerDereferenceableBytes
Phabricator via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Dec 20 02:02:22 PST 2017
This revision was automatically updated to reflect the committed changes.
Closed by commit rL321159: Give up on array allocas in getPointerDereferenceableBytes (authored by bsteinbr, committed by ).
Changed prior to commit:
https://reviews.llvm.org/D41398?vs=127542&id=127671#toc
Repository:
rL LLVM
https://reviews.llvm.org/D41398
Files:
llvm/trunk/lib/IR/Value.cpp
llvm/trunk/test/Analysis/ValueTracking/memory-dereferenceable.ll
Index: llvm/trunk/lib/IR/Value.cpp
===================================================================
--- llvm/trunk/lib/IR/Value.cpp
+++ llvm/trunk/lib/IR/Value.cpp
@@ -656,10 +656,8 @@
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->isArrayAllocation()) {
+ DerefBytes = DL.getTypeStoreSize(AI->getAllocatedType());
CanBeNull = false;
}
} else if (auto *GV = dyn_cast<GlobalVariable>(this)) {
Index: llvm/trunk/test/Analysis/ValueTracking/memory-dereferenceable.ll
===================================================================
--- llvm/trunk/test/Analysis/ValueTracking/memory-dereferenceable.ll
+++ llvm/trunk/test/Analysis/ValueTracking/memory-dereferenceable.ll
@@ -42,18 +42,6 @@
%empty_alloca = alloca i8, i64 0
%empty_load = load i8, i8* %empty_alloca
- ; Load from too small array alloca
-; CHECK-NOT: %small_array_alloca
- %small_array_alloca = alloca i8, i64 2
- %saa_cast = bitcast i8* %small_array_alloca to i32*
- %saa_load = load i32, i32* %saa_cast
-
- ; Load from array alloca
-; CHECK: %big_array_alloca{{.*}}(unaligned)
- %big_array_alloca = alloca i8, i64 4
- %baa_cast = bitcast i8* %big_array_alloca to i32*
- %baa_load = load i32, i32* %baa_cast
-
; Loads from sret arguments
; CHECK: %sret_gep{{.*}}(aligned)
%sret_gep = getelementptr inbounds %struct.A, %struct.A* %result, i64 0, i32 1, i64 2
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D41398.127671.patch
Type: text/x-patch
Size: 1686 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171220/dfd3f940/attachment.bin>
More information about the llvm-commits
mailing list