mirror of
https://github.com/intel/llvm.git
synced 2026-02-06 23:31:50 +08:00
[BasicAA] Remove unnecessary known size requirement
The size requirement on V2 was present because it was not clear whether an unknown size would allow an access before the start of V2, which could then overlap. This is clarified since D91649: In this part of BasicAA, all accesses can occur only after the base pointer, even if they have unknown size. This makes the positive and negative offset cases symmetric. Differential Revision: https://reviews.llvm.org/D91482
This commit is contained in:
@@ -1336,9 +1336,7 @@ AliasResult BasicAAResult::aliasGEP(
|
||||
// ---------------->|
|
||||
// |-->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 ((-DecompGEP1.Offset).ult(V1Size.getValue()))
|
||||
return PartialAlias;
|
||||
return NoAlias;
|
||||
|
||||
@@ -117,3 +117,13 @@ entry:
|
||||
%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)
|
||||
|
||||
Reference in New Issue
Block a user