mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-15 20:29:48 +00:00
Simplify logic further.
Ensure that we copy KnownProperties before calling visitBasicBlock, else we may leak properties into blocks where they don't belong. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30705 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
cd71da5cf0
commit
f938099aa1
@ -650,31 +650,22 @@ void PredicateSimplifier::visit(BranchInst *BI, PropertySet &KP) {
|
||||
BasicBlock *TrueDest = BI->getSuccessor(0),
|
||||
*FalseDest = BI->getSuccessor(1);
|
||||
|
||||
if (Condition == ConstantBool::getTrue() || TrueDest == FalseDest) {
|
||||
proceedToSuccessors(KP, BB);
|
||||
return;
|
||||
} else if (Condition == ConstantBool::getFalse()) {
|
||||
if (isa<ConstantBool>(Condition) || TrueDest == FalseDest) {
|
||||
proceedToSuccessors(KP, BB);
|
||||
return;
|
||||
}
|
||||
|
||||
DTNodeType *Node = DT->getNode(BB);
|
||||
for (DTNodeType::iterator I = Node->begin(), E = Node->end(); I != E; ++I) {
|
||||
if ((*I)->getBlock() == TrueDest) {
|
||||
PropertySet TrueProperties(KP);
|
||||
TrueProperties.addEqual(ConstantBool::getTrue(), Condition);
|
||||
visitBasicBlock(TrueDest, TrueProperties);
|
||||
continue;
|
||||
}
|
||||
BasicBlock *Dest = (*I)->getBlock();
|
||||
PropertySet DestProperties(KP);
|
||||
|
||||
if ((*I)->getBlock() == FalseDest) {
|
||||
PropertySet FalseProperties(KP);
|
||||
FalseProperties.addEqual(ConstantBool::getFalse(), Condition);
|
||||
visitBasicBlock(FalseDest, FalseProperties);
|
||||
continue;
|
||||
}
|
||||
if (Dest == TrueDest)
|
||||
DestProperties.addEqual(ConstantBool::getTrue(), Condition);
|
||||
else if (Dest == FalseDest)
|
||||
DestProperties.addEqual(ConstantBool::getFalse(), Condition);
|
||||
|
||||
visitBasicBlock((*I)->getBlock(), KP);
|
||||
visitBasicBlock(Dest, DestProperties);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user