forked from OSchip/llvm-project
Correctly handle replacement and removal of PHIs with one incoming register.
llvm-svn: 54374
This commit is contained in:
parent
182ab758a3
commit
bdaed55ef3
|
@ -27,6 +27,7 @@
|
|||
#include "llvm/Pass.h"
|
||||
#include "llvm/Type.h"
|
||||
#include "llvm/CodeGen/MachineFunctionPass.h"
|
||||
#include "llvm/CodeGen/MachineRegisterInfo.h"
|
||||
#include "llvm/Support/CFG.h"
|
||||
#include "llvm/Support/Compiler.h"
|
||||
#include "llvm/Target/TargetInstrInfo.h"
|
||||
|
@ -128,10 +129,15 @@ bool UnreachableMachineBlockElim::runOnMachineFunction(MachineFunction &F) {
|
|||
start->RemoveOperand(i-1);
|
||||
}
|
||||
|
||||
if (start->getNumOperands() == 1) {
|
||||
if (start->getNumOperands() == 3) {
|
||||
MachineInstr* phi = start;
|
||||
unsigned Input = phi->getOperand(1).getReg();
|
||||
unsigned Output = phi->getOperand(0).getReg();
|
||||
|
||||
start++;
|
||||
phi->eraseFromParent();
|
||||
|
||||
F.getRegInfo().replaceRegWith(Output, Input);
|
||||
} else
|
||||
start++;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue