mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-08-09 11:25:55 +00:00
Correctly handle replacement and removal of PHIs with one incoming register.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54374 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -27,6 +27,7 @@
|
|||||||
#include "llvm/Pass.h"
|
#include "llvm/Pass.h"
|
||||||
#include "llvm/Type.h"
|
#include "llvm/Type.h"
|
||||||
#include "llvm/CodeGen/MachineFunctionPass.h"
|
#include "llvm/CodeGen/MachineFunctionPass.h"
|
||||||
|
#include "llvm/CodeGen/MachineRegisterInfo.h"
|
||||||
#include "llvm/Support/CFG.h"
|
#include "llvm/Support/CFG.h"
|
||||||
#include "llvm/Support/Compiler.h"
|
#include "llvm/Support/Compiler.h"
|
||||||
#include "llvm/Target/TargetInstrInfo.h"
|
#include "llvm/Target/TargetInstrInfo.h"
|
||||||
@@ -128,10 +129,15 @@ bool UnreachableMachineBlockElim::runOnMachineFunction(MachineFunction &F) {
|
|||||||
start->RemoveOperand(i-1);
|
start->RemoveOperand(i-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (start->getNumOperands() == 1) {
|
if (start->getNumOperands() == 3) {
|
||||||
MachineInstr* phi = start;
|
MachineInstr* phi = start;
|
||||||
|
unsigned Input = phi->getOperand(1).getReg();
|
||||||
|
unsigned Output = phi->getOperand(0).getReg();
|
||||||
|
|
||||||
start++;
|
start++;
|
||||||
phi->eraseFromParent();
|
phi->eraseFromParent();
|
||||||
|
|
||||||
|
F.getRegInfo().replaceRegWith(Output, Input);
|
||||||
} else
|
} else
|
||||||
start++;
|
start++;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user