There's no need to consider PHI nodes in the same block as the instruction

we're inserting sigma/phi functions for. Patch by Andre Tavares.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75138 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Nick Lewycky
2009-07-09 15:59:27 +00:00
parent 4c12ee5f61
commit 89f43a5c70
3 changed files with 78 additions and 0 deletions

View File

@ -282,12 +282,16 @@ void SSI::substituteUse(Instruction *I) {
}
/// Test if the BasicBlock BB dominates any use or definition of value.
/// If it dominates a phi instruction that is on the same BasicBlock,
/// that does not count.
///
bool SSI::dominateAny(BasicBlock *BB, Instruction *value) {
for (Value::use_iterator begin = value->use_begin(),
end = value->use_end(); begin != end; ++begin) {
Instruction *I = cast<Instruction>(*begin);
BasicBlock *BB_father = I->getParent();
if (BB == BB_father && isa<PHINode>(I))
continue;
if (DT_->dominates(BB, BB_father)) {
return true;
}