mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-17 06:33:21 +00:00
Finegrainify namespacification
Reorder #includes Implement: IndVarsSimplify/2003-12-10-IndVarDeadCode.ll git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10376 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
01b2d61311
commit
ba4f3f6a41
@ -15,18 +15,18 @@
|
|||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
#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"
|
||||||
|
using namespace llvm;
|
||||||
namespace llvm {
|
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
Statistic<> NumRemoved ("indvars", "Number of aux indvars removed");
|
Statistic<> NumRemoved ("indvars", "Number of aux indvars removed");
|
||||||
@ -185,8 +185,28 @@ 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);
|
||||||
|
|
||||||
|
// If the PHI is the last user of any instructions for computing PHI nodes
|
||||||
|
// that are irrelevant now, delete those instructions.
|
||||||
|
while (!PHIOps.empty()) {
|
||||||
|
Instruction *MaybeDead = dyn_cast<Instruction>(PHIOps.back());
|
||||||
|
PHIOps.pop_back();
|
||||||
|
|
||||||
|
if (MaybeDead && isInstructionTriviallyDead(MaybeDead)) {
|
||||||
|
PHIOps.insert(PHIOps.end(), MaybeDead->op_begin(),
|
||||||
|
MaybeDead->op_end());
|
||||||
|
MaybeDead->getParent()->getInstList().erase(MaybeDead);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Changed = true;
|
Changed = true;
|
||||||
++NumRemoved;
|
++NumRemoved;
|
||||||
}
|
}
|
||||||
@ -216,8 +236,7 @@ namespace {
|
|||||||
"Canonicalize Induction Variables");
|
"Canonicalize Induction Variables");
|
||||||
}
|
}
|
||||||
|
|
||||||
Pass *createIndVarSimplifyPass() {
|
Pass *llvm::createIndVarSimplifyPass() {
|
||||||
return new InductionVariableSimplify();
|
return new InductionVariableSimplify();
|
||||||
}
|
}
|
||||||
|
|
||||||
} // End llvm namespace
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user