1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-18 18:42:46 +02:00

Support zero size types in StackSafetyAnalysis.

Reviewers: vitalybuka

Subscribers: hiraditya, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D73395
This commit is contained in:
Evgenii Stepanov 2020-01-24 16:36:24 -08:00
parent a55605a524
commit d2f0ede221
2 changed files with 21 additions and 0 deletions

View File

@ -252,6 +252,10 @@ StackSafetyLocalAnalysis::offsetFromAlloca(Value *Addr,
ConstantRange
StackSafetyLocalAnalysis::getAccessRange(Value *Addr, const Value *AllocaPtr,
ConstantRange SizeRange) {
// Zero-size loads and stores do not access memory.
if (SizeRange.isEmptySet())
return ConstantRange::getEmpty(PointerSize);
if (!SE.isSCEVable(Addr->getType()))
return UnknownRange;

View File

@ -368,3 +368,20 @@ entry:
store <vscale x 4 x i32> %v, <vscale x 4 x i32>* %p, align 4
ret void
}
%zerosize_type = type {}
define void @ZeroSize(%zerosize_type *%p) {
; CHECK-LABEL: @ZeroSize dso_preemptable{{$}}
; CHECK-NEXT: args uses:
; CHECK-NEXT: p[]: empty-set
; CHECK-NEXT: allocas uses:
; CHECK-NEXT: x[0]: empty-set
; CHECK-NOT: ]:
entry:
%x = alloca %zerosize_type, align 4
store %zerosize_type undef, %zerosize_type* %x, align 4
store %zerosize_type undef, %zerosize_type* undef, align 4
%val = load %zerosize_type, %zerosize_type* %p, align 4
ret void
}