[llvm-commits] [llvm] r126668 - in /llvm/trunk: include/llvm/Analysis/LiveValues.h include/llvm/Analysis/Passes.h include/llvm/InitializePasses.h include/llvm/LinkAllPasses.h lib/Analysis/Analysis.cpp lib/Analysis/LiveValues.cpp

Dan Gohman gohman at apple.com
Mon Feb 28 11:37:59 PST 2011


Author: djg
Date: Mon Feb 28 13:37:59 2011
New Revision: 126668

URL: http://llvm.org/viewvc/llvm-project?rev=126668&view=rev
Log:
Delete the LiveValues pass. I won't get get back to the project it
was started for in the foreseeable future.

Removed:
    llvm/trunk/include/llvm/Analysis/LiveValues.h
    llvm/trunk/lib/Analysis/LiveValues.cpp
Modified:
    llvm/trunk/include/llvm/Analysis/Passes.h
    llvm/trunk/include/llvm/InitializePasses.h
    llvm/trunk/include/llvm/LinkAllPasses.h
    llvm/trunk/lib/Analysis/Analysis.cpp

Removed: llvm/trunk/include/llvm/Analysis/LiveValues.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/LiveValues.h?rev=126667&view=auto
==============================================================================
--- llvm/trunk/include/llvm/Analysis/LiveValues.h (original)
+++ llvm/trunk/include/llvm/Analysis/LiveValues.h (removed)
@@ -1,99 +0,0 @@
-//===- LiveValues.h - Liveness information for LLVM IR Values. ------------===//
-//
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This file defines the interface for the LLVM IR Value liveness
-// analysis pass.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef LLVM_ANALYSIS_LIVEVALUES_H
-#define LLVM_ANALYSIS_LIVEVALUES_H
-
-#include "llvm/Pass.h"
-#include "llvm/ADT/DenseMap.h"
-#include "llvm/ADT/SmallPtrSet.h"
-
-namespace llvm {
-
-class DominatorTree;
-class LoopInfo;
-class Value;
-
-/// LiveValues - Analysis that provides liveness information for
-/// LLVM IR Values.
-///
-class LiveValues : public FunctionPass {
-  DominatorTree *DT;
-  LoopInfo *LI;
-
-  /// Memo - A bunch of state to be associated with a value.
-  ///
-  struct Memo {
-    /// Used - The set of blocks which contain a use of the value.
-    ///
-    SmallPtrSet<const BasicBlock *, 4> Used;
-
-    /// LiveThrough - A conservative approximation of the set of blocks in
-    /// which the value is live-through, meaning blocks properly dominated
-    /// by the definition, and from which blocks containing uses of the
-    /// value are reachable.
-    ///
-    SmallPtrSet<const BasicBlock *, 4> LiveThrough;
-
-    /// Killed - A conservative approximation of the set of blocks in which
-    /// the value is used and not live-out.
-    ///
-    SmallPtrSet<const BasicBlock *, 4> Killed;
-  };
-
-  /// Memos - Remembers the Memo for each Value. This is populated on
-  /// demand.
-  ///
-  DenseMap<const Value *, Memo> Memos;
-
-  /// getMemo - Retrieve an existing Memo for the given value if one
-  /// is available, otherwise compute a new one.
-  ///
-  Memo &getMemo(const Value *V);
-
-  /// compute - Compute a new Memo for the given value.
-  ///
-  Memo &compute(const Value *V);
-
-public:
-  static char ID;
-  LiveValues();
-
-  virtual void getAnalysisUsage(AnalysisUsage &AU) const;
-  virtual bool runOnFunction(Function &F);
-  virtual void releaseMemory();
-
-  /// isUsedInBlock - Test if the given value is used in the given block.
-  ///
-  bool isUsedInBlock(const Value *V, const BasicBlock *BB);
-
-  /// isLiveThroughBlock - Test if the given value is known to be
-  /// live-through the given block, meaning that the block is properly
-  /// dominated by the value's definition, and there exists a block
-  /// reachable from it that contains a use. This uses a conservative
-  /// approximation that errs on the side of returning false.
-  ///
-  bool isLiveThroughBlock(const Value *V, const BasicBlock *BB);
-
-  /// isKilledInBlock - Test if the given value is known to be killed in
-  /// the given block, meaning that the block contains a use of the value,
-  /// and no blocks reachable from the block contain a use. This uses a
-  /// conservative approximation that errs on the side of returning false.
-  ///
-  bool isKilledInBlock(const Value *V, const BasicBlock *BB);
-};
-
-}  // end namespace llvm
-
-#endif

Modified: llvm/trunk/include/llvm/Analysis/Passes.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/Passes.h?rev=126668&r1=126667&r2=126668&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Analysis/Passes.h (original)
+++ llvm/trunk/include/llvm/Analysis/Passes.h Mon Feb 28 13:37:59 2011
@@ -159,12 +159,6 @@
 
   //===--------------------------------------------------------------------===//
   //
-  // createLiveValuesPass - This creates an instance of the LiveValues pass.
-  //
-  FunctionPass *createLiveValuesPass();
-
-  //===--------------------------------------------------------------------===//
-  //
   /// createLazyValueInfoPass - This creates an instance of the LazyValueInfo
   /// pass.
   FunctionPass *createLazyValueInfoPass();

Modified: llvm/trunk/include/llvm/InitializePasses.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/InitializePasses.h?rev=126668&r1=126667&r2=126668&view=diff
==============================================================================
--- llvm/trunk/include/llvm/InitializePasses.h (original)
+++ llvm/trunk/include/llvm/InitializePasses.h Mon Feb 28 13:37:59 2011
@@ -123,7 +123,6 @@
 void initializeLiveDebugVariablesPass(PassRegistry&);
 void initializeLiveIntervalsPass(PassRegistry&);
 void initializeLiveStacksPass(PassRegistry&);
-void initializeLiveValuesPass(PassRegistry&);
 void initializeLiveVariablesPass(PassRegistry&);
 void initializeLoaderPassPass(PassRegistry&);
 void initializePathProfileLoaderPassPass(PassRegistry&);

Modified: llvm/trunk/include/llvm/LinkAllPasses.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/LinkAllPasses.h?rev=126668&r1=126667&r2=126668&view=diff
==============================================================================
--- llvm/trunk/include/llvm/LinkAllPasses.h (original)
+++ llvm/trunk/include/llvm/LinkAllPasses.h Mon Feb 28 13:37:59 2011
@@ -84,7 +84,6 @@
       (void) llvm::createLCSSAPass();
       (void) llvm::createLICMPass();
       (void) llvm::createLazyValueInfoPass();
-      (void) llvm::createLiveValuesPass();
       (void) llvm::createLoopDependenceAnalysisPass();
       (void) llvm::createLoopExtractorPass();
       (void) llvm::createLoopSimplifyPass();

Modified: llvm/trunk/lib/Analysis/Analysis.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/Analysis.cpp?rev=126668&r1=126667&r2=126668&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/Analysis.cpp (original)
+++ llvm/trunk/lib/Analysis/Analysis.cpp Mon Feb 28 13:37:59 2011
@@ -43,7 +43,6 @@
   initializeLazyValueInfoPass(Registry);
   initializeLibCallAliasAnalysisPass(Registry);
   initializeLintPass(Registry);
-  initializeLiveValuesPass(Registry);
   initializeLoopDependenceAnalysisPass(Registry);
   initializeLoopInfoPass(Registry);
   initializeMemDepPrinterPass(Registry);

Removed: llvm/trunk/lib/Analysis/LiveValues.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/LiveValues.cpp?rev=126667&view=auto
==============================================================================
--- llvm/trunk/lib/Analysis/LiveValues.cpp (original)
+++ llvm/trunk/lib/Analysis/LiveValues.cpp (removed)
@@ -1,200 +0,0 @@
-//===- LiveValues.cpp - Liveness information for LLVM IR Values. ----------===//
-//
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This file defines the implementation for the LLVM IR Value liveness
-// analysis pass.
-//
-//===----------------------------------------------------------------------===//
-
-#include "llvm/Analysis/LiveValues.h"
-#include "llvm/Instructions.h"
-#include "llvm/Analysis/Dominators.h"
-#include "llvm/Analysis/LoopInfo.h"
-using namespace llvm;
-
-namespace llvm {
-  FunctionPass *createLiveValuesPass() { return new LiveValues(); }
-}
-
-char LiveValues::ID = 0;
-INITIALIZE_PASS_BEGIN(LiveValues, "live-values",
-                "Value Liveness Analysis", false, true)
-INITIALIZE_PASS_DEPENDENCY(DominatorTree)
-INITIALIZE_PASS_DEPENDENCY(LoopInfo)
-INITIALIZE_PASS_END(LiveValues, "live-values",
-                "Value Liveness Analysis", false, true)
-
-LiveValues::LiveValues() : FunctionPass(ID) {
-  initializeLiveValuesPass(*PassRegistry::getPassRegistry());
-}
-
-void LiveValues::getAnalysisUsage(AnalysisUsage &AU) const {
-  AU.addRequired<DominatorTree>();
-  AU.addRequired<LoopInfo>();
-  AU.setPreservesAll();
-}
-
-bool LiveValues::runOnFunction(Function &F) {
-  DT = &getAnalysis<DominatorTree>();
-  LI = &getAnalysis<LoopInfo>();
-
-  // This pass' values are computed lazily, so there's nothing to do here.
-
-  return false;
-}
-
-void LiveValues::releaseMemory() {
-  Memos.clear();
-}
-
-/// isUsedInBlock - Test if the given value is used in the given block.
-///
-bool LiveValues::isUsedInBlock(const Value *V, const BasicBlock *BB) {
-  Memo &M = getMemo(V);
-  return M.Used.count(BB);
-}
-
-/// isLiveThroughBlock - Test if the given value is known to be
-/// live-through the given block, meaning that the block is properly
-/// dominated by the value's definition, and there exists a block
-/// reachable from it that contains a use. This uses a conservative
-/// approximation that errs on the side of returning false.
-///
-bool LiveValues::isLiveThroughBlock(const Value *V,
-                                    const BasicBlock *BB) {
-  Memo &M = getMemo(V);
-  return M.LiveThrough.count(BB);
-}
-
-/// isKilledInBlock - Test if the given value is known to be killed in
-/// the given block, meaning that the block contains a use of the value,
-/// and no blocks reachable from the block contain a use. This uses a
-/// conservative approximation that errs on the side of returning false.
-///
-bool LiveValues::isKilledInBlock(const Value *V, const BasicBlock *BB) {
-  Memo &M = getMemo(V);
-  return M.Killed.count(BB);
-}
-
-/// getMemo - Retrieve an existing Memo for the given value if one
-/// is available, otherwise compute a new one.
-///
-LiveValues::Memo &LiveValues::getMemo(const Value *V) {
-  DenseMap<const Value *, Memo>::iterator I = Memos.find(V);
-  if (I != Memos.end())
-    return I->second;
-  return compute(V);
-}
-
-/// getImmediateDominator - A handy utility for the specific DominatorTree
-/// query that we need here.
-///
-static const BasicBlock *getImmediateDominator(const BasicBlock *BB,
-                                               const DominatorTree *DT) {
-  DomTreeNode *Node = DT->getNode(const_cast<BasicBlock *>(BB))->getIDom();
-  return Node ? Node->getBlock() : 0;
-}
-
-/// compute - Compute a new Memo for the given value.
-///
-LiveValues::Memo &LiveValues::compute(const Value *V) {
-  Memo &M = Memos[V];
-
-  // Determine the block containing the definition.
-  const BasicBlock *DefBB;
-  // Instructions define values with meaningful live ranges.
-  if (const Instruction *I = dyn_cast<Instruction>(V))
-    DefBB = I->getParent();
-  // Arguments can be analyzed as values defined in the entry block.
-  else if (const Argument *A = dyn_cast<Argument>(V))
-    DefBB = &A->getParent()->getEntryBlock();
-  // Constants and other things aren't meaningful here, so just
-  // return having computed an empty Memo so that we don't come
-  // here again. The assumption here is that client code won't
-  // be asking about such values very often.
-  else
-    return M;
-
-  // Determine if the value is defined inside a loop. This is used
-  // to track whether the value is ever used outside the loop, so
-  // it'll be set to null if the value is either not defined in a
-  // loop or used outside the loop in which it is defined.
-  const Loop *L = LI->getLoopFor(DefBB);
-
-  // Track whether the value is used anywhere outside of the block
-  // in which it is defined.
-  bool LiveOutOfDefBB = false;
-
-  // Examine each use of the value.
-  for (Value::const_use_iterator I = V->use_begin(), E = V->use_end();
-       I != E; ++I) {
-    const User *U = *I;
-    const BasicBlock *UseBB = cast<Instruction>(U)->getParent();
-
-    // Note the block in which this use occurs.
-    M.Used.insert(UseBB);
-
-    // If the use block doesn't have successors, the value can be
-    // considered killed.
-    if (succ_begin(UseBB) == succ_end(UseBB))
-      M.Killed.insert(UseBB);
-
-    // Observe whether the value is used outside of the loop in which
-    // it is defined. Switch to an enclosing loop if necessary.
-    for (; L; L = L->getParentLoop())
-      if (L->contains(UseBB))
-        break;
-
-    // Search for live-through blocks.
-    const BasicBlock *BB;
-    if (const PHINode *PHI = dyn_cast<PHINode>(U)) {
-      // For PHI nodes, start the search at the incoming block paired with the
-      // incoming value, which must be dominated by the definition.
-      unsigned Num = PHI->getIncomingValueNumForOperand(I.getOperandNo());
-      BB = PHI->getIncomingBlock(Num);
-
-      // A PHI-node use means the value is live-out of it's defining block
-      // even if that block also contains the only use.
-      LiveOutOfDefBB = true;
-    } else {
-      // Otherwise just start the search at the use.
-      BB = UseBB;
-
-      // Note if the use is outside the defining block.
-      LiveOutOfDefBB |= UseBB != DefBB;
-    }
-
-    // Climb the immediate dominator tree from the use to the definition
-    // and mark all intermediate blocks as live-through.
-    for (; BB != DefBB; BB = getImmediateDominator(BB, DT)) {
-      if (BB != UseBB && !M.LiveThrough.insert(BB))
-        break;
-    }
-  }
-
-  // If the value is defined inside a loop and is not live outside
-  // the loop, then each exit block of the loop in which the value
-  // is used is a kill block.
-  if (L) {
-    SmallVector<BasicBlock *, 4> ExitingBlocks;
-    L->getExitingBlocks(ExitingBlocks);
-    for (unsigned i = 0, e = ExitingBlocks.size(); i != e; ++i) {
-      const BasicBlock *ExitingBlock = ExitingBlocks[i];
-      if (M.Used.count(ExitingBlock))
-        M.Killed.insert(ExitingBlock);
-    }
-  }
-
-  // If the value was never used outside the block in which it was
-  // defined, it's killed in that block.
-  if (!LiveOutOfDefBB)
-    M.Killed.insert(DefBB);
-
-  return M;
-}





More information about the llvm-commits mailing list