mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-08-18 12:29:21 +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),
|
BasicBlock *TrueDest = BI->getSuccessor(0),
|
||||||
*FalseDest = BI->getSuccessor(1);
|
*FalseDest = BI->getSuccessor(1);
|
||||||
|
|
||||||
if (Condition == ConstantBool::getTrue() || TrueDest == FalseDest) {
|
if (isa<ConstantBool>(Condition) || TrueDest == FalseDest) {
|
||||||
proceedToSuccessors(KP, BB);
|
|
||||||
return;
|
|
||||||
} else if (Condition == ConstantBool::getFalse()) {
|
|
||||||
proceedToSuccessors(KP, BB);
|
proceedToSuccessors(KP, BB);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
DTNodeType *Node = DT->getNode(BB);
|
DTNodeType *Node = DT->getNode(BB);
|
||||||
for (DTNodeType::iterator I = Node->begin(), E = Node->end(); I != E; ++I) {
|
for (DTNodeType::iterator I = Node->begin(), E = Node->end(); I != E; ++I) {
|
||||||
if ((*I)->getBlock() == TrueDest) {
|
BasicBlock *Dest = (*I)->getBlock();
|
||||||
PropertySet TrueProperties(KP);
|
PropertySet DestProperties(KP);
|
||||||
TrueProperties.addEqual(ConstantBool::getTrue(), Condition);
|
|
||||||
visitBasicBlock(TrueDest, TrueProperties);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((*I)->getBlock() == FalseDest) {
|
if (Dest == TrueDest)
|
||||||
PropertySet FalseProperties(KP);
|
DestProperties.addEqual(ConstantBool::getTrue(), Condition);
|
||||||
FalseProperties.addEqual(ConstantBool::getFalse(), Condition);
|
else if (Dest == FalseDest)
|
||||||
visitBasicBlock(FalseDest, FalseProperties);
|
DestProperties.addEqual(ConstantBool::getFalse(), Condition);
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
visitBasicBlock((*I)->getBlock(), KP);
|
visitBasicBlock(Dest, DestProperties);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user