Fix a layering violation: hasConstantValue, which is part of the PHINode
authorDuncan Sands <baldrick@free.fr>
Wed, 17 Nov 2010 04:30:22 +0000 (04:30 +0000)
committerDuncan Sands <baldrick@free.fr>
Wed, 17 Nov 2010 04:30:22 +0000 (04:30 +0000)
commitff10341183adf74760e6118a55cbd1debf50f90f
tree8ddc7145851c25d25499846ae47e84636c2660b6
parenta0c5244e8575ae91af318af09353ff34ac6bca1e
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
include/llvm/Instructions.h
lib/Analysis/InstructionSimplify.cpp
lib/Analysis/Lint.cpp
lib/VMCore/Instructions.cpp