[llvm-commits] CVS: llvm/lib/CodeGen/BranchFolding.cpp
Dale Johannesen
dalej at apple.com
Thu May 24 10:39:55 PDT 2007
Changes in directory llvm/lib/CodeGen:
BranchFolding.cpp updated: 1.56 -> 1.57
---
Log message:
Fix for PR1444: http://llvm.org/PR1444 : do not create two successors to the same block.
Temporarily, this breaks CodeGen/Generic/2006-02-12-InsertLibraryCall.ll
by exposing an unrelated latent problem; working on that.
---
Diffs of the changes: (+10 -2)
BranchFolding.cpp | 12 ++++++++++--
1 files changed, 10 insertions(+), 2 deletions(-)
Index: llvm/lib/CodeGen/BranchFolding.cpp
diff -u llvm/lib/CodeGen/BranchFolding.cpp:1.56 llvm/lib/CodeGen/BranchFolding.cpp:1.57
--- llvm/lib/CodeGen/BranchFolding.cpp:1.56 Wed May 23 16:07:20 2007
+++ llvm/lib/CodeGen/BranchFolding.cpp Thu May 24 12:39:32 2007
@@ -717,12 +717,20 @@
I->getOperand(i).setMachineBasicBlock(New);
}
- // Update the successor information.
+ // Update the successor information. If New was already a successor, just
+ // remove the link to Old instead of creating another one. PR 1444.
+ bool HadSuccessorNew = false;
std::vector<MachineBasicBlock*> Succs(BB->succ_begin(), BB->succ_end());
for (int i = Succs.size()-1; i >= 0; --i)
+ if (Succs[i] == New) {
+ HadSuccessorNew = true;
+ break;
+ }
+ for (int i = Succs.size()-1; i >= 0; --i)
if (Succs[i] == Old) {
BB->removeSuccessor(Old);
- BB->addSuccessor(New);
+ if (!HadSuccessorNew)
+ BB->addSuccessor(New);
}
}
More information about the llvm-commits
mailing list