Skip to content

Commit

Permalink
Lett users of sparse propagation do their own thing with phi nodes if…
Browse files Browse the repository at this point in the history
… they want

to. This can be combined with LCSSA or SSI form to store more information on a
PHINode than can be computed by looking at its incoming values.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82317 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
nlewycky committed Sep 19, 2009
1 parent ad38936 commit 875646f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
6 changes: 6 additions & 0 deletions include/llvm/Analysis/SparsePropagation.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,12 @@ class AbstractLatticeFunction {
virtual LatticeVal ComputeConstant(Constant *C) {
return getOverdefinedVal(); // always safe
}

/// IsSpecialCasedPHI - Given a PHI node, determine whether this PHI node is
/// one that the we want to handle through ComputeInstructionState.
virtual bool IsSpecialCasedPHI(PHINode *PN) {
return false;
}

/// GetConstant - If the specified lattice value is representable as an LLVM
/// constant value, return it. Otherwise return null. The returned value
Expand Down
7 changes: 7 additions & 0 deletions lib/Analysis/SparsePropagation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,13 @@ void SparseSolver::visitTerminatorInst(TerminatorInst &TI) {
}

void SparseSolver::visitPHINode(PHINode &PN) {
if (LatticeFunc->IsSpecialCasedPHI(&PN)) {
LatticeVal IV = LatticeFunc->ComputeInstructionState(PN, *this);
if (IV != LatticeFunc->getUntrackedVal())
UpdateState(PN, IV);
return;
}

LatticeVal PNIV = getOrInitValueState(&PN);
LatticeVal Overdefined = LatticeFunc->getOverdefinedVal();

Expand Down

0 comments on commit 875646f

Please sign in to comment.