aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Transforms/ObjCARC/DependencyAnalysis.cpp
diff options
context:
space:
mode:
authorMichael Gottesman <mgottesman@apple.com>2015-02-20 00:02:45 +0000
committerMichael Gottesman <mgottesman@apple.com>2015-02-20 00:02:45 +0000
commit5ab64de62bbea1a02ae611a50ec443cbccd72e7b (patch)
tree5a398c8e1259197a506602a861fb3e29936471f3 /llvm/lib/Transforms/ObjCARC/DependencyAnalysis.cpp
parentc50b75c75c3766a81701b6cfb5b381a9388b5130 (diff)
downloadllvm-5ab64de62bbea1a02ae611a50ec443cbccd72e7b.zip
llvm-5ab64de62bbea1a02ae611a50ec443cbccd72e7b.tar.gz
llvm-5ab64de62bbea1a02ae611a50ec443cbccd72e7b.tar.bz2
[objc-arc] Add the predicate CanDecrementRefCount.
This is different from CanAlterRefCount since CanDecrementRefCount is attempting to prove specifically whether or not an instruction can decrement instead of the more general question of whether it can decrement or increment. llvm-svn: 229936
Diffstat (limited to 'llvm/lib/Transforms/ObjCARC/DependencyAnalysis.cpp')
-rw-r--r--llvm/lib/Transforms/ObjCARC/DependencyAnalysis.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/ObjCARC/DependencyAnalysis.cpp b/llvm/lib/Transforms/ObjCARC/DependencyAnalysis.cpp
index 9eb91a5..4985d0e 100644
--- a/llvm/lib/Transforms/ObjCARC/DependencyAnalysis.cpp
+++ b/llvm/lib/Transforms/ObjCARC/DependencyAnalysis.cpp
@@ -66,6 +66,18 @@ bool llvm::objcarc::CanAlterRefCount(const Instruction *Inst, const Value *Ptr,
return true;
}
+bool llvm::objcarc::CanDecrementRefCount(const Instruction *Inst,
+ const Value *Ptr,
+ ProvenanceAnalysis &PA,
+ ARCInstKind Class) {
+ // First perform a quick check if Class can not touch ref counts.
+ if (!CanDecrementRefCount(Class))
+ return false;
+
+ // Otherwise, just use CanAlterRefCount for now.
+ return CanAlterRefCount(Inst, Ptr, PA, Class);
+}
+
/// Test whether the given instruction can "use" the given pointer's object in a
/// way that requires the reference count to be positive.
bool llvm::objcarc::CanUse(const Instruction *Inst, const Value *Ptr,