aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Lewycky <nicholas@mxc.ca>2007-06-06 11:26:20 +0000
committerNick Lewycky <nicholas@mxc.ca>2007-06-06 11:26:20 +0000
commit51e844b60168d019a293daddf19bd291c706dc3f (patch)
tree35783992cbe35b777ab8ff30e8a3e2653df13e6b
parent2c614c5c699fed503b93e85ea0cb48811843c3c7 (diff)
Optimize this test. Firstly, only Instructions may use other Instructions.
Secondly, checking whether removal succeeded tells you whether it was in the map to begin with. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37469 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Analysis/ScalarEvolution.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/Analysis/ScalarEvolution.cpp b/lib/Analysis/ScalarEvolution.cpp
index b1c3a17727..bf67fd3fff 100644
--- a/lib/Analysis/ScalarEvolution.cpp
+++ b/lib/Analysis/ScalarEvolution.cpp
@@ -1210,8 +1210,8 @@ void ScalarEvolutionsImpl::deleteInstructionFromRecords(Instruction *I) {
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)) {
+ Instruction *Inst = cast<Instruction>(*UI);
+ if (Scalars.erase(Inst)) {
if (PHINode *PN = dyn_cast<PHINode>(II))
ConstantEvolutionLoopExitValue.erase(PN);
Worklist.push_back(Inst);