diff options
author | Chris Lattner <sabre@nondot.org> | 2009-11-12 01:29:10 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2009-11-12 01:29:10 +0000 |
commit | 38392bbeb81233d0b342ad33166fc82ad922bc34 (patch) | |
tree | 99e205af22f02230682a5513f79ff41fd1c171d3 /lib/Analysis/LazyValueInfo.cpp | |
parent | f035ce58bcf66c45d7a956668ae950f1eeeb8b20 (diff) |
expose edge information and switch j-t to use it.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86920 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/LazyValueInfo.cpp')
-rw-r--r-- | lib/Analysis/LazyValueInfo.cpp | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/lib/Analysis/LazyValueInfo.cpp b/lib/Analysis/LazyValueInfo.cpp index c17b727459..6c306bd40b 100644 --- a/lib/Analysis/LazyValueInfo.cpp +++ b/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 |