/// an analyzable loop-invariant iteration count.
bool hasLoopInvariantIterationCount(const Loop *L) const;
- /// deleteInstructionFromRecords - This method should be called by the
- /// client before it removes an instruction from the program, to make sure
+ /// deleteValueFromRecords - This method should be called by the
+ /// client before it removes a Value from the program, to make sure
/// that no dangling references are left around.
- void deleteInstructionFromRecords(Instruction *I) const;
+ void deleteValueFromRecords(Value *V) const;
virtual bool runOnFunction(Function &F);
virtual void releaseMemory();
/// loop without a loop-invariant iteration count.
SCEVHandle getIterationCount(const Loop *L);
- /// deleteInstructionFromRecords - This method should be called by the
- /// client before it removes an instruction from the program, to make sure
+ /// deleteValueFromRecords - This method should be called by the
+ /// client before it removes a value from the program, to make sure
/// that no dangling references are left around.
- void deleteInstructionFromRecords(Instruction *I);
+ void deleteValueFromRecords(Value *V);
private:
/// createSCEV - We know that there is no SCEV for the specified value.
// Basic SCEV Analysis and PHI Idiom Recognition Code
//
-/// deleteInstructionFromRecords - This method should be called by the
+/// deleteValueFromRecords - This method should be called by the
/// client before it removes an instruction from the program, to make sure
/// that no dangling references are left around.
-void ScalarEvolutionsImpl::deleteInstructionFromRecords(Instruction *I) {
- SmallVector<Instruction *, 16> Worklist;
+void ScalarEvolutionsImpl::deleteValueFromRecords(Value *V) {
+ SmallVector<Value *, 16> Worklist;
- if (Scalars.erase(I)) {
- if (PHINode *PN = dyn_cast<PHINode>(I))
+ if (Scalars.erase(V)) {
+ if (PHINode *PN = dyn_cast<PHINode>(V))
ConstantEvolutionLoopExitValue.erase(PN);
- Worklist.push_back(I);
+ Worklist.push_back(V);
}
while (!Worklist.empty()) {
- Instruction *II = Worklist.back();
+ Value *VV = Worklist.back();
Worklist.pop_back();
- for (Instruction::use_iterator UI = II->use_begin(), UE = II->use_end();
+ for (Instruction::use_iterator UI = VV->use_begin(), UE = VV->use_end();
UI != UE; ++UI) {
Instruction *Inst = cast<Instruction>(*UI);
if (Scalars.erase(Inst)) {
- if (PHINode *PN = dyn_cast<PHINode>(II))
+ if (PHINode *PN = dyn_cast<PHINode>(VV))
ConstantEvolutionLoopExitValue.erase(PN);
Worklist.push_back(Inst);
}
return ((ScalarEvolutionsImpl*)Impl)->getSCEVAtScope(getSCEV(V), L);
}
-void ScalarEvolution::deleteInstructionFromRecords(Instruction *I) const {
- return ((ScalarEvolutionsImpl*)Impl)->deleteInstructionFromRecords(I);
+void ScalarEvolution::deleteValueFromRecords(Value *V) const {
+ return ((ScalarEvolutionsImpl*)Impl)->deleteValueFromRecords(V);
}
static void PrintLoopInfo(std::ostream &OS, const ScalarEvolution *SE,
for (unsigned i = 0, e = I->getNumOperands(); i != e; ++i)
if (Instruction *U = dyn_cast<Instruction>(I->getOperand(i)))
Insts.insert(U);
- SE->deleteInstructionFromRecords(I);
+ SE->deleteValueFromRecords(I);
DOUT << "INDVARS: Deleting: " << *I;
I->eraseFromParent();
Changed = true;
GetElementPtrInst *NGEPI = new GetElementPtrInst(
NCE, Constant::getNullValue(Type::Int32Ty), NewAdd,
GEPI->getName(), GEPI);
- SE->deleteInstructionFromRecords(GEPI);
+ SE->deleteValueFromRecords(GEPI);
GEPI->replaceAllUsesWith(NGEPI);
GEPI->eraseFromParent();
GEPI = NGEPI;
// the PHI entirely. This is safe, because the NewVal won't be variant
// in the loop, so we don't need an LCSSA phi node anymore.
if (NumPreds == 1) {
- SE->deleteInstructionFromRecords(PN);
+ SE->deleteValueFromRecords(PN);
PN->replaceAllUsesWith(ExitVal);
PN->eraseFromParent();
break;