remove the LowerSelect pass. The last client was the old Sparc backend, which is...
authorChris Lattner <sabre@nondot.org>
Tue, 19 Feb 2008 07:49:17 +0000 (07:49 +0000)
committerChris Lattner <sabre@nondot.org>
Tue, 19 Feb 2008 07:49:17 +0000 (07:49 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47323 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/LinkAllPasses.h
include/llvm/Transforms/Scalar.h
lib/Transforms/Utils/LowerAllocations.cpp
lib/Transforms/Utils/LowerInvoke.cpp
lib/Transforms/Utils/LowerSelect.cpp [deleted file]
lib/Transforms/Utils/LowerSwitch.cpp
lib/Transforms/Utils/Mem2Reg.cpp
lib/Transforms/Utils/UnifyFunctionExitNodes.cpp

index 603e87b003ac3aa987c4e8fda563e97edcbfd093..973178d6765c1ec811d6c0d52fddb559a58b60c0 100644 (file)
@@ -84,7 +84,6 @@ namespace {
       (void) llvm::createLoopIndexSplitPass();
       (void) llvm::createLowerAllocationsPass();
       (void) llvm::createLowerInvokePass();
-      (void) llvm::createLowerSelectPass();
       (void) llvm::createLowerSetJmpPass();
       (void) llvm::createLowerSwitchPass();
       (void) llvm::createNoAAPass();
index eb6e012feac096445ba840d1d8f2683a7d6cfaa3..f07877b15a71235cdcc29d41c7a667f28a029402 100644 (file)
@@ -229,15 +229,6 @@ extern const PassInfo *BreakCriticalEdgesID;
 FunctionPass *createLoopSimplifyPass();
 extern const PassInfo *LoopSimplifyID;
 
-//===----------------------------------------------------------------------===//
-//
-// LowerSelect - This pass converts SelectInst instructions into conditional
-// branch and PHI instructions. If the OnlyFP flag is set to true, then only
-// floating point select instructions are lowered.
-//
-FunctionPass *createLowerSelectPass(bool OnlyFP = false);
-extern const PassInfo *LowerSelectID;
-
 //===----------------------------------------------------------------------===//
 //
 // LowerAllocations - Turn malloc and free instructions into %malloc and %free
index a43ec4b3573a730d222a2cdf837145ed62f676fe..2f422609fe362abc8c6b90acdac122fd59234215 100644 (file)
@@ -48,7 +48,6 @@ namespace {
       // This is a cluster of orthogonal Transforms:
       AU.addPreserved<UnifyFunctionExitNodes>();
       AU.addPreservedID(PromoteMemoryToRegisterID);
-      AU.addPreservedID(LowerSelectID);
       AU.addPreservedID(LowerSwitchID);
       AU.addPreservedID(LowerInvokePassID);
     }
index 920a0286ead2f6dd5ff5b694368ec50261410aa7..7f0ef85d75ffcabca44bc258846cea4bf58c2145 100644 (file)
@@ -84,7 +84,6 @@ namespace {
     virtual void getAnalysisUsage(AnalysisUsage &AU) const {
       // This is a cluster of orthogonal Transforms
       AU.addPreservedID(PromoteMemoryToRegisterID);
-      AU.addPreservedID(LowerSelectID);
       AU.addPreservedID(LowerSwitchID);
       AU.addPreservedID(LowerAllocationsID);
     }
diff --git a/lib/Transforms/Utils/LowerSelect.cpp b/lib/Transforms/Utils/LowerSelect.cpp
deleted file mode 100644 (file)
index e2940c2..0000000
+++ /dev/null
@@ -1,105 +0,0 @@
-//===- LowerSelect.cpp - Transform select insts to branches ---------------===//
-//
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This pass lowers select instructions into conditional branches for targets
-// that do not have conditional moves or that have not implemented the select
-// instruction yet.
-//
-// Note that this pass could be improved.  In particular it turns every select
-// instruction into a new conditional branch, even though some common cases have
-// select instructions on the same predicate next to each other.  It would be
-// better to use the same branch for the whole group of selects.
-//
-//===----------------------------------------------------------------------===//
-
-#include "llvm/Transforms/Scalar.h"
-#include "llvm/Transforms/Utils/UnifyFunctionExitNodes.h"
-#include "llvm/Function.h"
-#include "llvm/Instructions.h"
-#include "llvm/Pass.h"
-#include "llvm/Type.h"
-#include "llvm/Support/Compiler.h"
-using namespace llvm;
-
-namespace {
-  /// LowerSelect - Turn select instructions into conditional branches.
-  ///
-  class VISIBILITY_HIDDEN LowerSelect : public FunctionPass {
-    bool OnlyFP;   // Only lower FP select instructions?
-  public:
-    static char ID; // Pass identification, replacement for typeid
-    explicit LowerSelect(bool onlyfp = false) : FunctionPass((intptr_t)&ID), 
-      OnlyFP(onlyfp) {}
-
-    virtual void getAnalysisUsage(AnalysisUsage &AU) const {
-      // This certainly destroys the CFG.
-      // This is a cluster of orthogonal Transforms:
-      AU.addPreserved<UnifyFunctionExitNodes>();
-      AU.addPreservedID(PromoteMemoryToRegisterID);
-      AU.addPreservedID(LowerSwitchID);
-      AU.addPreservedID(LowerInvokePassID);
-      AU.addPreservedID(LowerAllocationsID);
-    }
-
-    bool runOnFunction(Function &F);
-  };
-
-  char LowerSelect::ID = 0;
-  RegisterPass<LowerSelect>
-  X("lowerselect", "Lower select instructions to branches");
-}
-
-// Publically exposed interface to pass...
-const PassInfo *llvm::LowerSelectID = X.getPassInfo();
-//===----------------------------------------------------------------------===//
-// This pass converts SelectInst instructions into conditional branch and PHI
-// instructions.  If the OnlyFP flag is set to true, then only floating point
-// select instructions are lowered.
-//
-FunctionPass *llvm::createLowerSelectPass(bool OnlyFP) {
-  return new LowerSelect(OnlyFP);
-}
-
-
-bool LowerSelect::runOnFunction(Function &F) {
-  bool Changed = false;
-  for (Function::iterator BB = F.begin(), E = F.end(); BB != E; ++BB)
-    for (BasicBlock::iterator I = BB->begin(), E = BB->end(); I != E; ++I) {
-      if (SelectInst *SI = dyn_cast<SelectInst>(I))
-        if (!OnlyFP || SI->getType()->isFloatingPoint()) {
-          // Split this basic block in half right before the select instruction.
-          BasicBlock *NewCont =
-            BB->splitBasicBlock(I, BB->getName()+".selectcont");
-
-          // Make the true block, and make it branch to the continue block.
-          BasicBlock *NewTrue = new BasicBlock(BB->getName()+".selecttrue",
-                                               BB->getParent(), NewCont);
-          new BranchInst(NewCont, NewTrue);
-
-          // Make the unconditional branch in the incoming block be a
-          // conditional branch on the select predicate.
-          BB->getInstList().erase(BB->getTerminator());
-          new BranchInst(NewTrue, NewCont, SI->getCondition(), BB);
-
-          // Create a new PHI node in the cont block with the entries we need.
-          PHINode *PN = new PHINode(SI->getType(), "", NewCont->begin());
-          PN->takeName(SI);
-          PN->addIncoming(SI->getTrueValue(), NewTrue);
-          PN->addIncoming(SI->getFalseValue(), BB);
-
-          // Use the PHI instead of the select.
-          SI->replaceAllUsesWith(PN);
-          NewCont->getInstList().erase(SI);
-
-          Changed = true;
-          break; // This block is done with.
-        }
-    }
-  return Changed;
-}
index 5f5e796a358959494548c104cd232976ab39238c..e31a87fba8e7a0b375452918564171bee7a43daa 100644 (file)
@@ -40,7 +40,6 @@ namespace {
       // This is a cluster of orthogonal Transforms
       AU.addPreserved<UnifyFunctionExitNodes>();
       AU.addPreservedID(PromoteMemoryToRegisterID);
-      AU.addPreservedID(LowerSelectID);
       AU.addPreservedID(LowerInvokePassID);
       AU.addPreservedID(LowerAllocationsID);
     }
index 75e66db9330098a563bebea0242816e0cb91bc8e..f9b1d8d4994acdb13041a7ac7d53bcd427a28c2b 100644 (file)
@@ -43,7 +43,6 @@ namespace {
       AU.setPreservesCFG();
       // This is a cluster of orthogonal Transforms
       AU.addPreserved<UnifyFunctionExitNodes>();
-      AU.addPreservedID(LowerSelectID);
       AU.addPreservedID(LowerSwitchID);
       AU.addPreservedID(LowerInvokePassID);
       AU.addPreservedID(LowerAllocationsID);
index d8802abfb1e6bbc2c520f7bb302d7ef97c388219..f9aaa236666133dc59fad6c00e3a074212edb699 100644 (file)
@@ -37,7 +37,6 @@ void UnifyFunctionExitNodes::getAnalysisUsage(AnalysisUsage &AU) const{
   AU.addPreservedID(BreakCriticalEdgesID);
   // This is a cluster of orthogonal Transforms
   AU.addPreservedID(PromoteMemoryToRegisterID);
-  AU.addPreservedID(LowerSelectID);
   AU.addPreservedID(LowerSwitchID);
 }