summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Analysis
diff options
context:
space:
mode:
authorNick Lewycky <nicholas@mxc.ca>2011-06-27 04:20:45 +0000
committerNick Lewycky <nicholas@mxc.ca>2011-06-27 04:20:45 +0000
commit3e334a42d703e0d1c482e564ca05192db6e83047 (patch)
treefe0b50e223dcc4c5b0052392b4667b80869b44cf /llvm/lib/Analysis
parentff653a2eed121f0fce363a24923083bd989f92e3 (diff)
downloadbcm5719-llvm-3e334a42d703e0d1c482e564ca05192db6e83047.tar.gz
bcm5719-llvm-3e334a42d703e0d1c482e564ca05192db6e83047.zip
Move onlyUsedByLifetimeMarkers to ValueTracking so that it can be used by other
passes as well. llvm-svn: 133904
Diffstat (limited to 'llvm/lib/Analysis')
-rw-r--r--llvm/lib/Analysis/ValueTracking.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/llvm/lib/Analysis/ValueTracking.cpp b/llvm/lib/Analysis/ValueTracking.cpp
index dab5aebd6c6..130e3ced42d 100644
--- a/llvm/lib/Analysis/ValueTracking.cpp
+++ b/llvm/lib/Analysis/ValueTracking.cpp
@@ -1783,3 +1783,19 @@ llvm::GetUnderlyingObject(Value *V, const TargetData *TD, unsigned MaxLookup) {
}
return V;
}
+
+/// onlyUsedByLifetimeMarkers - Return true if the only users of this pointer
+/// are lifetime markers.
+///
+bool llvm::onlyUsedByLifetimeMarkers(const Value *V) {
+ for (Value::const_use_iterator UI = V->use_begin(), UE = V->use_end();
+ UI != UE; ++UI) {
+ const IntrinsicInst *II = dyn_cast<IntrinsicInst>(*UI);
+ if (!II) return false;
+
+ if (II->getIntrinsicID() != Intrinsic::lifetime_start &&
+ II->getIntrinsicID() != Intrinsic::lifetime_end)
+ return false;
+ }
+ return true;
+}
OpenPOWER on IntegriCloud