Reverted back to previous revision - this was previously merged
according to the CVS log messages. llvm-svn: 10517
This commit is contained in:
parent
86a3a48697
commit
b22e9b4b35
|
@ -15,19 +15,19 @@
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
#include "llvm/Transforms/Scalar.h"
|
#include "llvm/Transforms/Scalar.h"
|
||||||
#include "llvm/Analysis/InductionVariable.h"
|
#include "llvm/Constants.h"
|
||||||
#include "llvm/Analysis/LoopInfo.h"
|
#include "llvm/Type.h"
|
||||||
#include "llvm/iPHINode.h"
|
#include "llvm/iPHINode.h"
|
||||||
#include "llvm/iOther.h"
|
#include "llvm/iOther.h"
|
||||||
#include "llvm/Type.h"
|
#include "llvm/Analysis/InductionVariable.h"
|
||||||
#include "llvm/Constants.h"
|
#include "llvm/Analysis/LoopInfo.h"
|
||||||
#include "llvm/Support/CFG.h"
|
#include "llvm/Support/CFG.h"
|
||||||
|
#include "llvm/Transforms/Utils/Local.h"
|
||||||
#include "Support/Debug.h"
|
#include "Support/Debug.h"
|
||||||
#include "Support/Statistic.h"
|
#include "Support/Statistic.h"
|
||||||
#include "Support/STLExtras.h"
|
#include "Support/STLExtras.h"
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
using namespace llvm;
|
||||||
namespace llvm {
|
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
Statistic<> NumRemoved ("indvars", "Number of aux indvars removed");
|
Statistic<> NumRemoved ("indvars", "Number of aux indvars removed");
|
||||||
|
@ -141,6 +141,8 @@ static bool TransformLoop(LoopInfo *Loops, Loop *Loop) {
|
||||||
|
|
||||||
DEBUG(IV->print(std::cerr));
|
DEBUG(IV->print(std::cerr));
|
||||||
|
|
||||||
|
while (isa<PHINode>(AfterPHIIt)) ++AfterPHIIt;
|
||||||
|
|
||||||
// Don't do math with pointers...
|
// Don't do math with pointers...
|
||||||
const Type *IVTy = IV->Phi->getType();
|
const Type *IVTy = IV->Phi->getType();
|
||||||
if (isa<PointerType>(IVTy)) IVTy = Type::ULongTy;
|
if (isa<PointerType>(IVTy)) IVTy = Type::ULongTy;
|
||||||
|
@ -186,6 +188,12 @@ static bool TransformLoop(LoopInfo *Loops, Loop *Loop) {
|
||||||
IV->Phi->setName("");
|
IV->Phi->setName("");
|
||||||
Val->setName(OldName);
|
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...
|
// Delete the old, now unused, phi node...
|
||||||
Header->getInstList().erase(IV->Phi);
|
Header->getInstList().erase(IV->Phi);
|
||||||
|
|
||||||
|
@ -242,8 +250,7 @@ namespace {
|
||||||
"Canonicalize Induction Variables");
|
"Canonicalize Induction Variables");
|
||||||
}
|
}
|
||||||
|
|
||||||
Pass *createIndVarSimplifyPass() {
|
Pass *llvm::createIndVarSimplifyPass() {
|
||||||
return new InductionVariableSimplify();
|
return new InductionVariableSimplify();
|
||||||
}
|
}
|
||||||
|
|
||||||
} // End llvm namespace
|
|
||||||
|
|
Loading…
Reference in New Issue