mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-02-09 13:33:17 +00:00
UnreachableBlockElim could incorrectly return false when it had not modified the CFG, but HAD modified some PHI nodes. Fixes PR8174.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@115083 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
36c4debc94
commit
b0725316cd
@ -118,6 +118,7 @@ void UnreachableMachineBlockElim::getAnalysisUsage(AnalysisUsage &AU) const {
|
||||
|
||||
bool UnreachableMachineBlockElim::runOnMachineFunction(MachineFunction &F) {
|
||||
SmallPtrSet<MachineBasicBlock*, 8> Reachable;
|
||||
bool ModifiedPHI = false;
|
||||
|
||||
MMI = getAnalysisIfAvailable<MachineModuleInfo>();
|
||||
MachineDominatorTree *MDT = getAnalysisIfAvailable<MachineDominatorTree>();
|
||||
@ -179,6 +180,7 @@ bool UnreachableMachineBlockElim::runOnMachineFunction(MachineFunction &F) {
|
||||
if (!preds.count(phi->getOperand(i).getMBB())) {
|
||||
phi->RemoveOperand(i);
|
||||
phi->RemoveOperand(i-1);
|
||||
ModifiedPHI = true;
|
||||
}
|
||||
|
||||
if (phi->getNumOperands() == 3) {
|
||||
@ -188,6 +190,7 @@ bool UnreachableMachineBlockElim::runOnMachineFunction(MachineFunction &F) {
|
||||
MachineInstr* temp = phi;
|
||||
++phi;
|
||||
temp->eraseFromParent();
|
||||
ModifiedPHI = true;
|
||||
|
||||
if (Input != Output)
|
||||
F.getRegInfo().replaceRegWith(Output, Input);
|
||||
@ -201,5 +204,5 @@ bool UnreachableMachineBlockElim::runOnMachineFunction(MachineFunction &F) {
|
||||
|
||||
F.RenumberBlocks();
|
||||
|
||||
return DeadBlocks.size();
|
||||
return (DeadBlocks.size() || ModifiedPHI);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user