mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-25 13:24:46 +00:00
Fix a layering violation: hasConstantValue, which is part of the PHINode
class, uses DominatorTree which is an analysis. This change moves all of the tricky hasConstantValue logic to SimplifyInstruction, and replaces it with a very simple literal implementation. I already taught users of hasConstantValue that need tricky stuff to use SimplifyInstruction instead. I didn't update InlineFunction because the IR looks like it might be in a funky state at the point it calls hasConstantValue, which makes calling SimplifyInstruction dangerous since it can in theory do a lot of tricky reasoning. This may be a pessimization, for example in the case where all phi node operands are either undef or a fixed constant. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@119459 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -29,7 +29,6 @@ class ConstantInt;
|
||||
class ConstantRange;
|
||||
class APInt;
|
||||
class LLVMContext;
|
||||
class DominatorTree;
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// AllocaInst Class
|
||||
@@ -1946,13 +1945,7 @@ public:
|
||||
|
||||
/// hasConstantValue - If the specified PHI node always merges together the
|
||||
/// same value, return the value, otherwise return null.
|
||||
///
|
||||
/// 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(const DominatorTree *DT = 0) const;
|
||||
Value *hasConstantValue() const;
|
||||
|
||||
/// Methods for support type inquiry through isa, cast, and dyn_cast:
|
||||
static inline bool classof(const PHINode *) { return true; }
|
||||
|
Reference in New Issue
Block a user