[PATCH] D91482: [BasicAA] Remove unnecessary known size requirement
Nikita Popov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Nov 20 09:58:21 PST 2020
nikic updated this revision to Diff 306722.
nikic edited the summary of this revision.
nikic added a comment.
Rebase over D91649 <https://reviews.llvm.org/D91649>, after which this correctness of this change should be more obvious. At this point in BasicAA, all LocationSizes only allow access after the base pointer.
The changes to MemorySSA tests are now gone.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D91482/new/
https://reviews.llvm.org/D91482
Files:
llvm/lib/Analysis/BasicAliasAnalysis.cpp
llvm/test/Analysis/BasicAA/negoffset.ll
Index: llvm/test/Analysis/BasicAA/negoffset.ll
===================================================================
--- llvm/test/Analysis/BasicAA/negoffset.ll
+++ llvm/test/Analysis/BasicAA/negoffset.ll
@@ -117,3 +117,13 @@
%2 = load i32, i32* %1
ret i32 %2
}
+
+; CHECK-LABEL: Function: one_size_unknown:
+; CHECK: NoModRef: Ptr: i8* %p.minus1 <-> call void @llvm.memset.p0i8.i32(i8* %p, i8 0, i32 %size, i1 false)
+define void @one_size_unknown(i8* %p, i32 %size) {
+ %p.minus1 = getelementptr inbounds i8, i8* %p, i32 -1
+ call void @llvm.memset.p0i8.i32(i8* %p, i8 0, i32 %size, i1 false)
+ ret void
+}
+
+declare void @llvm.memset.p0i8.i32(i8*, i8, i32, i1)
Index: llvm/lib/Analysis/BasicAliasAnalysis.cpp
===================================================================
--- llvm/lib/Analysis/BasicAliasAnalysis.cpp
+++ llvm/lib/Analysis/BasicAliasAnalysis.cpp
@@ -1345,9 +1345,7 @@
// ---------------->|
// |-->V1Size |-------> V2Size
// GEP1 V2
- // We need to know that V2Size is not unknown, otherwise we might have
- // stripped a gep with negative index ('gep <ptr>, -1, ...).
- if (V1Size.hasValue() && V2Size.hasValue()) {
+ if (V1Size.hasValue()) {
if ((-GEP1BaseOffset).ult(V1Size.getValue()))
return PartialAlias;
return NoAlias;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D91482.306722.patch
Type: text/x-patch
Size: 1349 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20201120/4331de5b/attachment.bin>
More information about the llvm-commits
mailing list