[llvm-commits] [llvm] r82317 - in /llvm/trunk: include/llvm/Analysis/SparsePropagation.h lib/Analysis/SparsePropagation.cpp

Nick Lewycky nicholas at mxc.ca
Sat Sep 19 11:33:36 PDT 2009


Author: nicholas
Date: Sat Sep 19 13:33:36 2009
New Revision: 82317

URL: http://llvm.org/viewvc/llvm-project?rev=82317&view=rev
Log:
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.

Modified:
    llvm/trunk/include/llvm/Analysis/SparsePropagation.h
    llvm/trunk/lib/Analysis/SparsePropagation.cpp

Modified: llvm/trunk/include/llvm/Analysis/SparsePropagation.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/SparsePropagation.h?rev=82317&r1=82316&r2=82317&view=diff

==============================================================================
--- llvm/trunk/include/llvm/Analysis/SparsePropagation.h (original)
+++ llvm/trunk/include/llvm/Analysis/SparsePropagation.h Sat Sep 19 13:33:36 2009
@@ -72,6 +72,12 @@
   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

Modified: llvm/trunk/lib/Analysis/SparsePropagation.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/SparsePropagation.cpp?rev=82317&r1=82316&r2=82317&view=diff

==============================================================================
--- llvm/trunk/lib/Analysis/SparsePropagation.cpp (original)
+++ llvm/trunk/lib/Analysis/SparsePropagation.cpp Sat Sep 19 13:33:36 2009
@@ -223,6 +223,13 @@
 }
 
 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();
   





More information about the llvm-commits mailing list