Skip to content

Commit

Permalink
When propagating equalities, eg replacing A with B in every basic block
Browse files Browse the repository at this point in the history
dominated by Root, check that B is available throughout the scope.  This
is obviously true (famous last words?) given the current logic, but the
check may be helpful if more complicated reasoning is added one day.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@153323 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
CunningBaldrick committed Mar 23, 2012
1 parent 01b305f commit e959f7e
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/Transforms/Scalar/GVN.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2001,6 +2001,9 @@ bool GVN::propagateEquality(Value *LHS, Value *RHS, BasicBlock *Root) {
LVN = RVN;
}
}
assert((!isa<Instruction>(RHS) ||
DT->properlyDominates(cast<Instruction>(RHS)->getParent(), Root)) &&
"Instruction doesn't dominate scope!");

// If value numbering later deduces that an instruction in the scope is equal
// to 'LHS' then ensure it will be turned into 'RHS'.
Expand Down

0 comments on commit e959f7e

Please sign in to comment.