forked from OSchip/llvm-project
[Attributor] Return uses do not free pointers
If a pointer is returned that does not mean it is freed in the current (function) scope. We can ignore such uses in AANoFree.
This commit is contained in:
parent
4c62a35860
commit
f95553923f
|
@ -1772,6 +1772,8 @@ struct AANoFreeFloating : AANoFreeImpl {
|
|||
Follow = true;
|
||||
return true;
|
||||
}
|
||||
if (isa<ReturnInst>(UserI))
|
||||
return true;
|
||||
|
||||
// Unknown user.
|
||||
return false;
|
||||
|
|
|
@ -334,8 +334,8 @@ if.end:
|
|||
; BOTH: declare void @unknown_fn(i32* (i32*)*)
|
||||
;
|
||||
; BOTH: Function Attrs: noinline nounwind uwtable
|
||||
; BOTH-NEXT: define i32* @calls_unknown_fn(i32* readnone returned "no-capture-maybe-returned" %r)
|
||||
; ATTRIBUTOR: define i32* @calls_unknown_fn(i32* readnone returned "no-capture-maybe-returned" %r)
|
||||
; BOTH-NEXT: define i32* @calls_unknown_fn(i32* nofree readnone returned "no-capture-maybe-returned" %r)
|
||||
; ATTRIBUTOR: define i32* @calls_unknown_fn(i32* nofree readnone returned "no-capture-maybe-returned" %r)
|
||||
declare void @unknown_fn(i32* (i32*)*) #0
|
||||
|
||||
define i32* @calls_unknown_fn(i32* %r) #0 {
|
||||
|
|
Loading…
Reference in New Issue