summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/BranchFolding.cpp
diff options
context:
space:
mode:
authorDevang Patel <dpatel@apple.com>2011-05-26 21:47:59 +0000
committerDevang Patel <dpatel@apple.com>2011-05-26 21:47:59 +0000
commit42ddaa10d3f42101fc6a055fd2d4a423bbba3b8c (patch)
tree664e2e62f2bec10a751a8c8e5f42323512ea224c /llvm/lib/CodeGen/BranchFolding.cpp
parent0c0f977840bb48a4a548246aa5a79d6936e6005a (diff)
downloadbcm5719-llvm-42ddaa10d3f42101fc6a055fd2d4a423bbba3b8c.tar.gz
bcm5719-llvm-42ddaa10d3f42101fc6a055fd2d4a423bbba3b8c.zip
During branch folding avoid inserting redundant DBG_VALUE machine instructions.
llvm-svn: 132148
Diffstat (limited to 'llvm/lib/CodeGen/BranchFolding.cpp')
-rw-r--r--llvm/lib/CodeGen/BranchFolding.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/BranchFolding.cpp b/llvm/lib/CodeGen/BranchFolding.cpp
index 6fafc758d05..2bcd59f1bd8 100644
--- a/llvm/lib/CodeGen/BranchFolding.cpp
+++ b/llvm/lib/CodeGen/BranchFolding.cpp
@@ -1056,6 +1056,19 @@ ReoptimizeBlock:
!MBB->hasAddressTaken() && !MBB->isLandingPad()) {
DEBUG(dbgs() << "\nMerging into block: " << PrevBB
<< "From MBB: " << *MBB);
+ if (PrevBB.begin() != PrevBB.end()) {
+ MachineBasicBlock::iterator PrevBBIter = PrevBB.end();
+ --PrevBBIter;
+ MachineBasicBlock::iterator MBBIter = MBB->begin();
+ while (PrevBBIter != PrevBB.begin() && MBBIter != MBB->end()
+ && PrevBBIter->isDebugValue() && MBBIter->isDebugValue()) {
+ if (!MBBIter->isIdenticalTo(PrevBBIter))
+ break;
+ MachineInstr *DuplicateDbg = MBBIter;
+ ++MBBIter; -- PrevBBIter;
+ DuplicateDbg->eraseFromParent();
+ }
+ }
PrevBB.splice(PrevBB.end(), MBB, MBB->begin(), MBB->end());
PrevBB.removeSuccessor(PrevBB.succ_begin());;
assert(PrevBB.succ_empty());
OpenPOWER on IntegriCloud