diff options
author | Owen Anderson <resistor@mac.com> | 2010-09-29 20:57:19 +0000 |
---|---|---|
committer | Owen Anderson <resistor@mac.com> | 2010-09-29 20:57:19 +0000 |
commit | b0725316cd1807b954eed4b9966250249d1fd884 (patch) | |
tree | 75f6e1d27c47b460c2dc4f5d234672740e49a9a2 /lib/CodeGen | |
parent | 36c4debc94e7c68c769dfda781851a0c963dd746 (diff) | |
download | external_llvm-b0725316cd1807b954eed4b9966250249d1fd884.zip external_llvm-b0725316cd1807b954eed4b9966250249d1fd884.tar.gz external_llvm-b0725316cd1807b954eed4b9966250249d1fd884.tar.bz2 |
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
Diffstat (limited to 'lib/CodeGen')
-rw-r--r-- | lib/CodeGen/UnreachableBlockElim.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/CodeGen/UnreachableBlockElim.cpp b/lib/CodeGen/UnreachableBlockElim.cpp index 6dd3333..ebf1129 100644 --- a/lib/CodeGen/UnreachableBlockElim.cpp +++ b/lib/CodeGen/UnreachableBlockElim.cpp @@ -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); } |