[llvm-commits] [llvm] r115083 - /llvm/trunk/lib/CodeGen/UnreachableBlockElim.cpp
Owen Anderson
resistor at mac.com
Wed Sep 29 13:57:19 PDT 2010
Author: resistor
Date: Wed Sep 29 15:57:19 2010
New Revision: 115083
URL: http://llvm.org/viewvc/llvm-project?rev=115083&view=rev
Log:
UnreachableBlockElim could incorrectly return false when it had not modified the CFG, but HAD modified some PHI nodes. Fixes PR8174.
Modified:
llvm/trunk/lib/CodeGen/UnreachableBlockElim.cpp
Modified: llvm/trunk/lib/CodeGen/UnreachableBlockElim.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/UnreachableBlockElim.cpp?rev=115083&r1=115082&r2=115083&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/UnreachableBlockElim.cpp (original)
+++ llvm/trunk/lib/CodeGen/UnreachableBlockElim.cpp Wed Sep 29 15:57:19 2010
@@ -118,6 +118,7 @@
bool UnreachableMachineBlockElim::runOnMachineFunction(MachineFunction &F) {
SmallPtrSet<MachineBasicBlock*, 8> Reachable;
+ bool ModifiedPHI = false;
MMI = getAnalysisIfAvailable<MachineModuleInfo>();
MachineDominatorTree *MDT = getAnalysisIfAvailable<MachineDominatorTree>();
@@ -179,6 +180,7 @@
if (!preds.count(phi->getOperand(i).getMBB())) {
phi->RemoveOperand(i);
phi->RemoveOperand(i-1);
+ ModifiedPHI = true;
}
if (phi->getNumOperands() == 3) {
@@ -188,6 +190,7 @@
MachineInstr* temp = phi;
++phi;
temp->eraseFromParent();
+ ModifiedPHI = true;
if (Input != Output)
F.getRegInfo().replaceRegWith(Output, Input);
@@ -201,5 +204,5 @@
F.RenumberBlocks();
- return DeadBlocks.size();
+ return (DeadBlocks.size() || ModifiedPHI);
}
More information about the llvm-commits
mailing list