Change PHINode::hasConstantValue to have a DominatorTree argument

instead of a bool argument, and to do the dominator check itself.
This makes it eaiser to use when DominatorTree information is
available.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80920 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Dan Gohman
2009-09-03 15:34:35 +00:00
parent dd12de686c
commit bccfc24c4e
7 changed files with 49 additions and 37 deletions

View File

@ -31,6 +31,7 @@ class ConstantInt;
class ConstantRange;
class APInt;
class LLVMContext;
class DominatorTree;
//===----------------------------------------------------------------------===//
// AllocationInst Class
@ -1950,7 +1951,12 @@ public:
/// hasConstantValue - If the specified PHI node always merges together the
/// same value, return the value, otherwise return null.
///
Value *hasConstantValue(bool AllowNonDominatingInstruction = false) const;
/// If the PHI has undef operands, but all the rest of the operands are
/// some unique value, return that value if it can be proved that the
/// value dominates the PHI. If DT is null, use a conservative check,
/// otherwise use DT to test for dominance.
///
Value *hasConstantValue(DominatorTree *DT = 0) const;
/// Methods for support type inquiry through isa, cast, and dyn_cast:
static inline bool classof(const PHINode *) { return true; }