[llvm-commits] CVS: llvm/lib/Analysis/ScalarEvolution.cpp
Chris Lattner
clattner at apple.com
Tue Jun 5 21:24:40 PDT 2007
> Fix PR1487: http://llvm.org/PR1487 and Transforms/IndVar/
> 2007-06-06-DeleteDanglesPtr.ll
Thanks Nicholas,
> /// client before it removes an instruction from the program, to
> make sure
> /// that no dangling references are left around.
> void ScalarEvolutionsImpl::deleteInstructionFromRecords
> (Instruction *I) {
> + while (!Worklist.empty()) {
> + Instruction *II = Worklist.back();
> + Worklist.pop_back();
> +
> + for (Instruction::use_iterator UI = II->use_begin(), UE = II-
> >use_end();
> + UI != UE; ++UI) {
> + Instruction *Inst = dyn_cast<Instruction>(*UI);
> + if (Inst && hasSCEV(Inst) && Scalars.erase(Inst)) {
One more thing, sorry I didn't notice this before:
The only thing that can use Instructions are other intstructions. As
such, you can change the dyn_cast<instruction> into cast<instruction>
and there is no need to check for null in the next line.
-Chris
> + if (PHINode *PN = dyn_cast<PHINode>(II))
> + ConstantEvolutionLoopExitValue.erase(PN);
> + Worklist.push_back(Inst);
> + }
> + }
> + }
> }
>
>
>
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
More information about the llvm-commits
mailing list