mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-01-31 12:41:49 +01:00
[DSE] Use same logic as legacy impl to check if free kills a location.
This patch updates DSE + MemorySSA to use the same check as the legacy implementation to determine if a location is killed by a free call. This changes the existing behavior so that a free does not kill locations before the start of the freed pointer. This should fix PR48036.
This commit is contained in:
parent
cdee713390
commit
dc7616bd85
@ -1857,9 +1857,13 @@ struct DSEState {
|
||||
getUnderlyingObject(MaybeTermLoc->first.Ptr))
|
||||
return false;
|
||||
|
||||
auto TermLoc = MaybeTermLoc->first;
|
||||
if (MaybeTermLoc->second) {
|
||||
const Value *LocUO = getUnderlyingObject(Loc.Ptr);
|
||||
return BatchAA.isMustAlias(TermLoc.Ptr, LocUO);
|
||||
}
|
||||
int64_t InstWriteOffset, DepWriteOffset;
|
||||
return MaybeTermLoc->second ||
|
||||
isOverwrite(MaybeTerm, AccessI, MaybeTermLoc->first, Loc, DL, TLI,
|
||||
return isOverwrite(MaybeTerm, AccessI, TermLoc, Loc, DL, TLI,
|
||||
DepWriteOffset, InstWriteOffset, BatchAA,
|
||||
&F) == OW_Complete;
|
||||
}
|
||||
|
@ -90,9 +90,12 @@ bb:
|
||||
|
||||
; Test case inspired by PR48036.
|
||||
define void @delete_field_after(%struct* %ptr) {
|
||||
;
|
||||
; CHECK-LABEL: @delete_field_after(
|
||||
; CHECK-NEXT: [[PTR_F0:%.*]] = getelementptr [[STRUCT:%.*]], %struct* [[PTR:%.*]], i32 1
|
||||
; CHECK-NEXT: [[BC:%.*]] = bitcast %struct* [[PTR_F0]] to i8*
|
||||
; CHECK-NEXT: [[PTR_F1:%.*]] = getelementptr [[STRUCT]], %struct* [[PTR]], i32 0, i32 1
|
||||
; CHECK-NEXT: store i32 0, i32* [[PTR_F1]], align 4
|
||||
; CHECK-NEXT: call void @free(i8* [[BC]])
|
||||
; CHECK-NEXT: ret void
|
||||
;
|
||||
|
Loading…
x
Reference in New Issue
Block a user