mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-21 16:31:16 +00:00
use SimplifyInstruction instead of reimplementing part of it.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121757 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
995ba1bd49
commit
07ff3539f5
@ -1172,17 +1172,14 @@ static bool FoldTwoEntryPHINode(PHINode *PN, const TargetData *TD) {
|
||||
BasicBlock::iterator AfterPHIIt = BB->begin();
|
||||
while (isa<PHINode>(AfterPHIIt)) {
|
||||
PHINode *PN = cast<PHINode>(AfterPHIIt++);
|
||||
if (PN->getIncomingValue(0) == PN->getIncomingValue(1)) {
|
||||
if (PN->getIncomingValue(0) != PN)
|
||||
PN->replaceAllUsesWith(PN->getIncomingValue(0));
|
||||
else
|
||||
PN->replaceAllUsesWith(UndefValue::get(PN->getType()));
|
||||
} else if (!DominatesMergePoint(PN->getIncomingValue(0), BB,
|
||||
&AggressiveInsts) ||
|
||||
!DominatesMergePoint(PN->getIncomingValue(1), BB,
|
||||
&AggressiveInsts)) {
|
||||
return false;
|
||||
if (Value *V = SimplifyInstruction(PN, TD)) {
|
||||
PN->replaceAllUsesWith(V);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!DominatesMergePoint(PN->getIncomingValue(0), BB, &AggressiveInsts) ||
|
||||
!DominatesMergePoint(PN->getIncomingValue(1), BB, &AggressiveInsts))
|
||||
return false;
|
||||
}
|
||||
|
||||
// If we all PHI nodes are promotable, check to make sure that all
|
||||
|
Loading…
Reference in New Issue
Block a user