Micro-optimization, no functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@151524 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Duncan Sands 2012-02-27 12:11:41 +00:00
parent b4b2688db0
commit 768ada611b

View File

@ -2041,13 +2041,18 @@ bool GVN::propagateEquality(Value *LHS, Value *RHS, BasicBlock *Root) {
// Since we don't have the instruction "A < B" immediately to hand, work out // Since we don't have the instruction "A < B" immediately to hand, work out
// the value number that it would have and use that to find an appropriate // the value number that it would have and use that to find an appropriate
// instruction (if any). // instruction (if any).
unsigned Num = VN.lookup_or_add_cmp(Cmp->getOpcode(), NotPred, Op0, Op1); uint32_t NextNum = VN.getNextUnusedValueNumber();
Value *NotCmp = findLeader(Root, Num); uint32_t Num = VN.lookup_or_add_cmp(Cmp->getOpcode(), NotPred, Op0, Op1);
if (NotCmp && isa<Instruction>(NotCmp)) { // If the number we were assigned was brand new then there is no point in
unsigned NumReplacements = // looking for an instruction realizing it: there cannot be one!
replaceAllDominatedUsesWith(NotCmp, NotVal, Root); if (Num < NextNum) {
Changed |= NumReplacements > 0; Value *NotCmp = findLeader(Root, Num);
NumGVNEqProp += NumReplacements; if (NotCmp && isa<Instruction>(NotCmp)) {
unsigned NumReplacements =
replaceAllDominatedUsesWith(NotCmp, NotVal, Root);
Changed |= NumReplacements > 0;
NumGVNEqProp += NumReplacements;
}
} }
// Ensure that any instruction in scope that gets the "A < B" value number // Ensure that any instruction in scope that gets the "A < B" value number
// is replaced with false. // is replaced with false.