[llvm] [ObjCARC] Optimize MayAutorelease by skipping over pools (PR #188583)
via llvm-commits
llvm-commits at lists.llvm.org
Wed Apr 8 12:09:24 PDT 2026
================
@@ -2527,16 +2542,18 @@ bool MayAutorelease(const CallBase &CB, unsigned Depth = 0) {
case ARCInstKind::CopyWeak:
case ARCInstKind::DestroyWeak:
case ARCInstKind::StoreStrong:
- case ARCInstKind::AutoreleasepoolPush:
- case ARCInstKind::AutoreleasepoolPop:
// These ObjC runtime functions don't produce autoreleases
break;
case ARCInstKind::CallOrUser:
case ARCInstKind::Call:
- // For non-ObjC function calls, recursively analyze
- if (MayAutorelease(cast<CallBase>(I), Depth + 1))
- return true;
+ // For non-ObjC function calls, recursively analyze. Calls inside a
+ // pool are skipped the same way as explicit autorelease ops inside
+ // it.
+ if (PoolStack.empty()) {
+ if (MayAutorelease(cast<CallBase>(I), Depth + 1))
+ return true;
+ }
----------------
SiliconA-Z wrote:
Fixed!
https://github.com/llvm/llvm-project/pull/188583
More information about the llvm-commits
mailing list