summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Analysis/LazyValueInfo.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-11-12 01:29:10 +0000
committerChris Lattner <sabre@nondot.org>2009-11-12 01:29:10 +0000
commitd5e25436a19eae5f2fc9e48b15ad461b31c67fa0 (patch)
tree217bba6bb809ef69a64a7d9cc23d06bc89887f7e /llvm/lib/Analysis/LazyValueInfo.cpp
parentbff25cb044d9a16e46ac38fefe078d2dd3eb6edb (diff)
downloadbcm5719-llvm-d5e25436a19eae5f2fc9e48b15ad461b31c67fa0.tar.gz
bcm5719-llvm-d5e25436a19eae5f2fc9e48b15ad461b31c67fa0.zip
expose edge information and switch j-t to use it.
llvm-svn: 86920
Diffstat (limited to 'llvm/lib/Analysis/LazyValueInfo.cpp')
-rw-r--r--llvm/lib/Analysis/LazyValueInfo.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/llvm/lib/Analysis/LazyValueInfo.cpp b/llvm/lib/Analysis/LazyValueInfo.cpp
index c17b7274594..6c306bd40b0 100644
--- a/llvm/lib/Analysis/LazyValueInfo.cpp
+++ b/llvm/lib/Analysis/LazyValueInfo.cpp
@@ -270,6 +270,27 @@ Constant *LazyValueInfo::getConstant(Value *V, BasicBlock *BB) {
return 0;
}
+/// getConstantOnEdge - Determine whether the specified value is known to be a
+/// constant on the specified edge. Return null if not.
+Constant *LazyValueInfo::getConstantOnEdge(Value *V, BasicBlock *FromBB,
+ BasicBlock *ToBB) {
+ // If already a constant, return it.
+ if (Constant *VC = dyn_cast<Constant>(V))
+ return VC;
+
+ DenseMap<BasicBlock*, LVILatticeVal> BlockValues;
+
+ DEBUG(errs() << "Getting value " << *V << " on edge from '"
+ << FromBB->getName() << "' to '" << ToBB->getName() << "'\n");
+ LVILatticeVal Result = GetValueOnEdge(V, FromBB, ToBB, BlockValues);
+
+ DEBUG(errs() << " Result = " << Result << "\n");
+
+ if (Result.isConstant())
+ return Result.getConstant();
+ return 0;
+}
+
/// isEqual - Determine whether the specified value is known to be equal or
/// not-equal to the specified constant at the end of the specified block.
LazyValueInfo::Tristate
OpenPOWER on IntegriCloud