[PATCH] D9384: llvm.noalias - isPointerDereferenceable should look through them
Hal Finkel via llvm-commits
llvm-commits at lists.llvm.org
Sun Jul 10 20:16:17 PDT 2016
This revision was automatically updated to reflect the committed changes.
Closed by commit rL275038: Teach isDereferenceablePointer to look through returned-argument functions (authored by hfinkel).
Changed prior to commit:
http://reviews.llvm.org/D9384?vs=63351&id=63454#toc
Repository:
rL LLVM
http://reviews.llvm.org/D9384
Files:
llvm/trunk/lib/Analysis/Loads.cpp
llvm/trunk/test/Analysis/ValueTracking/memory-dereferenceable.ll
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
@@ -43,7 +43,8 @@
%load4 = load i32, i32 addrspace(1)* %relocate
; CHECK-NOT: %nparam
- %nparam = getelementptr i32, i32 addrspace(1)* %dparam, i32 5
+ %dpa = call i32 addrspace(1)* @func1(i32 addrspace(1)* %dparam)
+ %nparam = getelementptr i32, i32 addrspace(1)* %dpa, i32 5
%load5 = load i32, i32 addrspace(1)* %nparam
; Load from a non-dereferenceable load
@@ -162,6 +163,8 @@
declare token @llvm.experimental.gc.statepoint.p0f_i1f(i64, i32, i1 ()*, i32, i32, ...)
declare i32 addrspace(1)* @llvm.experimental.gc.relocate.p1i32(token, i32, i32)
+declare i32 addrspace(1)* @func1(i32 addrspace(1)* returned) nounwind argmemonly
+
!0 = !{i64 4}
!1 = !{i64 2}
!2 = !{}
Index: llvm/trunk/lib/Analysis/Loads.cpp
===================================================================
--- llvm/trunk/lib/Analysis/Loads.cpp
+++ llvm/trunk/lib/Analysis/Loads.cpp
@@ -101,6 +101,11 @@
return isDereferenceableAndAlignedPointer(ASC->getOperand(0), Align, Size,
DL, CtxI, DT, Visited);
+ if (auto CS = ImmutableCallSite(V))
+ if (const Value *RV = CS.getReturnedArgOperand())
+ return isDereferenceableAndAlignedPointer(RV, Align, Size, DL, CtxI, DT,
+ Visited);
+
// If we don't know, assume the worst.
return false;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D9384.63454.patch
Type: text/x-patch
Size: 1640 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160711/a9679879/attachment.bin>
More information about the llvm-commits
mailing list