summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Lewycky <nicholas@mxc.ca>2009-09-19 18:33:36 +0000
committerNick Lewycky <nicholas@mxc.ca>2009-09-19 18:33:36 +0000
commit875646f376f6c83bf8426fdb44e1dbf312cf784e (patch)
tree85dc6d15ec799d5116ec32c9a8db80f1b01a9a25
parentad3893678172e7b22a6d4ef3e6387b8d773aa1c7 (diff)
downloadllvm-875646f376f6c83bf8426fdb44e1dbf312cf784e.tar.gz
llvm-875646f376f6c83bf8426fdb44e1dbf312cf784e.tar.bz2
llvm-875646f376f6c83bf8426fdb44e1dbf312cf784e.tar.xz
Lett users of sparse propagation do their own thing with phi nodes if 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
-rw-r--r--include/llvm/Analysis/SparsePropagation.h6
-rw-r--r--lib/Analysis/SparsePropagation.cpp7
2 files changed, 13 insertions, 0 deletions
diff --git a/include/llvm/Analysis/SparsePropagation.h b/include/llvm/Analysis/SparsePropagation.h
index cc655aa85f..820e1bd1e4 100644
--- a/include/llvm/Analysis/SparsePropagation.h
+++ b/include/llvm/Analysis/SparsePropagation.h
@@ -72,6 +72,12 @@ public:
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
diff --git a/lib/Analysis/SparsePropagation.cpp b/lib/Analysis/SparsePropagation.cpp
index 17bb73f991..8a74745dd3 100644
--- a/lib/Analysis/SparsePropagation.cpp
+++ b/lib/Analysis/SparsePropagation.cpp
@@ -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();