[all-commits] [llvm/llvm-project] 327972: llvm/ObjCARC: Eliminate inlined AutoreleaseRV calls
Duncan P. N. Exon Smith via All-commits
all-commits at lists.llvm.org
Tue Nov 19 12:02:20 PST 2019
Branch: refs/heads/master
Home: https://github.com/llvm/llvm-project
Commit: 3279724905c14a8db383ade53af40a0dd49504d8
https://github.com/llvm/llvm-project/commit/3279724905c14a8db383ade53af40a0dd49504d8
Author: Duncan P. N. Exon Smith <dexonsmith at apple.com>
Date: 2019-11-19 (Tue, 19 Nov 2019)
Changed paths:
M llvm/lib/Transforms/ObjCARC/ObjCARCOpts.cpp
A llvm/test/Transforms/ObjCARC/inlined-autorelease-return-value.ll
M llvm/test/Transforms/ObjCARC/unsafe-claim-rv.ll
Log Message:
-----------
llvm/ObjCARC: Eliminate inlined AutoreleaseRV calls
Pair up inlined AutoreleaseRV calls with their matching RetainRV or
ClaimRV.
- RetainRV cancels out AutoreleaseRV. Delete both instructions.
- ClaimRV is a peephole for RetainRV+Release. Delete AutoreleaseRV and
replace ClaimRV with Release.
This avoids problems where more aggressive inlining triggers memory
regressions.
This patch is happy to skip over non-callable instructions and non-ARC
intrinsics looking for the pair. It is likely sound to also skip over
opaque function calls, but that's harder to reason about, and it's not
relevant to the goal here: if there's an opaque function call splitting
up a pair, it's very unlikely that a handshake would have happened
dynamically without inlining.
Note that this patch also subsumes the previous logic that looked
backwards from ReleaseRV.
https://reviews.llvm.org/D70370
rdar://problem/46509586
More information about the All-commits
mailing list