summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/ObjCARC/DependencyAnalysis.cpp
diff options
context:
space:
mode:
authorMichael Gottesman <mgottesman@apple.com>2015-02-19 00:42:38 +0000
committerMichael Gottesman <mgottesman@apple.com>2015-02-19 00:42:38 +0000
commite5ad66f8a9ba5157660e717e603cda66894b512c (patch)
treebf2c371753872747a3b66e909e29e74b6f55a01c /llvm/lib/Transforms/ObjCARC/DependencyAnalysis.cpp
parentdfa3e4b08a89f76e228fdd03b55ff061c4100dd9 (diff)
downloadbcm5719-llvm-e5ad66f8a9ba5157660e717e603cda66894b512c.tar.gz
bcm5719-llvm-e5ad66f8a9ba5157660e717e603cda66894b512c.zip
[objc-arc] Introduce the concept of RCIdentity and rename all relevant functions to use that name. NFC.
The RCIdentity root ("Reference Count Identity Root") of a value V is a dominating value U for which retaining or releasing U is equivalent to retaining or releasing V. In other words, ARC operations on V are equivalent to ARC operations on U. This is a useful property to ascertain since we can use this in the ARC optimizer to make it easier to match up ARC operations by always mapping ARC operations to RCIdentityRoots instead of pointers themselves. Then we perform pairing of retains, releases which are applied to the same RCIdentityRoot. In general, the two ways that we see RCIdentical values in ObjC are via: 1. PointerCasts 2. Forwarding Calls that return their argument verbatim. As such in ObjC, two RCIdentical pointers must always point to the same memory location. Previously this concept was implicit in the code and various methods that dealt with this concept were given functional names that did not conform to any name in the "ARC" model. This often times resulted in code that was hard for the non-ARC acquanted to understand resulting in unhappiness and confusion. llvm-svn: 229796
Diffstat (limited to 'llvm/lib/Transforms/ObjCARC/DependencyAnalysis.cpp')
-rw-r--r--llvm/lib/Transforms/ObjCARC/DependencyAnalysis.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/llvm/lib/Transforms/ObjCARC/DependencyAnalysis.cpp b/llvm/lib/Transforms/ObjCARC/DependencyAnalysis.cpp
index f6c236c31ef..9160493212a 100644
--- a/llvm/lib/Transforms/ObjCARC/DependencyAnalysis.cpp
+++ b/llvm/lib/Transforms/ObjCARC/DependencyAnalysis.cpp
@@ -171,7 +171,7 @@ llvm::objcarc::Depends(DependenceKind Flavor, Instruction *Inst,
case IC_Retain:
case IC_RetainRV:
// Check for a retain of the same pointer for merging.
- return GetObjCArg(Inst) == Arg;
+ return GetArgRCIdentityRoot(Inst) == Arg;
default:
// Nothing else matters for objc_retainAutorelease formation.
return false;
@@ -183,7 +183,7 @@ llvm::objcarc::Depends(DependenceKind Flavor, Instruction *Inst,
case IC_Retain:
case IC_RetainRV:
// Check for a retain of the same pointer for merging.
- return GetObjCArg(Inst) == Arg;
+ return GetArgRCIdentityRoot(Inst) == Arg;
default:
// Anything that can autorelease interrupts
// retainAutoreleaseReturnValue formation.
OpenPOWER on IntegriCloud