summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Scalar
diff options
context:
space:
mode:
authorJohn Criswell <criswell@uiuc.edu>2003-12-18 17:19:19 +0000
committerJohn Criswell <criswell@uiuc.edu>2003-12-18 17:19:19 +0000
commitb22e9b4b350b99a09560fec122bc7cb880209d9e (patch)
tree63067b8cd8bc1b08cbd801e1bdc89eb2650aaea2 /llvm/lib/Transforms/Scalar
parent86a3a486971fb9b56f1d92f7dcb6ce17e9ec55c7 (diff)
downloadbcm5719-llvm-b22e9b4b350b99a09560fec122bc7cb880209d9e.tar.gz
bcm5719-llvm-b22e9b4b350b99a09560fec122bc7cb880209d9e.zip
Reverted back to previous revision - this was previously merged
according to the CVS log messages. llvm-svn: 10517
Diffstat (limited to 'llvm/lib/Transforms/Scalar')
-rw-r--r--llvm/lib/Transforms/Scalar/IndVarSimplify.cpp23
1 files changed, 15 insertions, 8 deletions
diff --git a/llvm/lib/Transforms/Scalar/IndVarSimplify.cpp b/llvm/lib/Transforms/Scalar/IndVarSimplify.cpp
index 0cc408c61b7..763854ee0b1 100644
--- a/llvm/lib/Transforms/Scalar/IndVarSimplify.cpp
+++ b/llvm/lib/Transforms/Scalar/IndVarSimplify.cpp
@@ -15,19 +15,19 @@
//===----------------------------------------------------------------------===//
#include "llvm/Transforms/Scalar.h"
-#include "llvm/Analysis/InductionVariable.h"
-#include "llvm/Analysis/LoopInfo.h"
+#include "llvm/Constants.h"
+#include "llvm/Type.h"
#include "llvm/iPHINode.h"
#include "llvm/iOther.h"
-#include "llvm/Type.h"
-#include "llvm/Constants.h"
+#include "llvm/Analysis/InductionVariable.h"
+#include "llvm/Analysis/LoopInfo.h"
#include "llvm/Support/CFG.h"
+#include "llvm/Transforms/Utils/Local.h"
#include "Support/Debug.h"
#include "Support/Statistic.h"
#include "Support/STLExtras.h"
#include <algorithm>
-
-namespace llvm {
+using namespace llvm;
namespace {
Statistic<> NumRemoved ("indvars", "Number of aux indvars removed");
@@ -141,6 +141,8 @@ static bool TransformLoop(LoopInfo *Loops, Loop *Loop) {
DEBUG(IV->print(std::cerr));
+ while (isa<PHINode>(AfterPHIIt)) ++AfterPHIIt;
+
// Don't do math with pointers...
const Type *IVTy = IV->Phi->getType();
if (isa<PointerType>(IVTy)) IVTy = Type::ULongTy;
@@ -186,6 +188,12 @@ static bool TransformLoop(LoopInfo *Loops, Loop *Loop) {
IV->Phi->setName("");
Val->setName(OldName);
+ // Get the incoming values used by the PHI node
+ std::vector<Value*> PHIOps;
+ PHIOps.reserve(IV->Phi->getNumIncomingValues());
+ for (unsigned i = 0, e = IV->Phi->getNumIncomingValues(); i != e; ++i)
+ PHIOps.push_back(IV->Phi->getIncomingValue(i));
+
// Delete the old, now unused, phi node...
Header->getInstList().erase(IV->Phi);
@@ -242,8 +250,7 @@ namespace {
"Canonicalize Induction Variables");
}
-Pass *createIndVarSimplifyPass() {
+Pass *llvm::createIndVarSimplifyPass() {
return new InductionVariableSimplify();
}
-} // End llvm namespace
OpenPOWER on IntegriCloud