Branch instructions don't produce values, so there's no need to generate a value number for them. This

avoids adding them to the various value numbering tables, resulting in a minor (~3%) speedup for GVN
on 40.gcc.

llvm-svn: 122819
This commit is contained in:
Owen Anderson 2011-01-04 18:54:18 +00:00
parent 35c7e84eb7
commit 41a1550ef5
1 changed files with 3 additions and 5 deletions

View File

@ -1670,14 +1670,9 @@ bool GVN::processInstruction(Instruction *I,
return Changed; return Changed;
} }
uint32_t NextNum = VN.getNextUnusedValueNumber();
unsigned Num = VN.lookup_or_add(I);
// For conditions branches, we can perform simple conditional propagation on // For conditions branches, we can perform simple conditional propagation on
// the condition value itself. // the condition value itself.
if (BranchInst *BI = dyn_cast<BranchInst>(I)) { if (BranchInst *BI = dyn_cast<BranchInst>(I)) {
insert_table(Num, I, I->getParent());
if (!BI->isConditional() || isa<Constant>(BI->getCondition())) if (!BI->isConditional() || isa<Constant>(BI->getCondition()))
return false; return false;
@ -1699,6 +1694,9 @@ bool GVN::processInstruction(Instruction *I,
return false; return false;
} }
uint32_t NextNum = VN.getNextUnusedValueNumber();
unsigned Num = VN.lookup_or_add(I);
// Allocations are always uniquely numbered, so we can save time and memory // Allocations are always uniquely numbered, so we can save time and memory
// by fast failing them. // by fast failing them.
if (isa<AllocaInst>(I) || isa<TerminatorInst>(I) || isa<PHINode>(I)) { if (isa<AllocaInst>(I) || isa<TerminatorInst>(I) || isa<PHINode>(I)) {