[llvm-commits] [llvm] r98181 - /llvm/trunk/lib/CodeGen/BranchFolding.cpp
Dale Johannesen
dalej at apple.com
Wed Mar 10 11:57:56 PST 2010
Author: johannes
Date: Wed Mar 10 13:57:56 2010
New Revision: 98181
URL: http://llvm.org/viewvc/llvm-project?rev=98181&view=rev
Log:
Fix another place where DEBUG_VALUE affected codegen.
Modified:
llvm/trunk/lib/CodeGen/BranchFolding.cpp
Modified: llvm/trunk/lib/CodeGen/BranchFolding.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/BranchFolding.cpp?rev=98181&r1=98180&r2=98181&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/BranchFolding.cpp (original)
+++ llvm/trunk/lib/CodeGen/BranchFolding.cpp Wed Mar 10 13:57:56 2010
@@ -984,6 +984,17 @@
return true;
}
+// Blocks with only debug info and branches should be considered the same
+// as blocks with only branches.
+static bool IsBranchOnlyBlock(MachineBasicBlock *MBB) {
+ MachineBasicBlock::iterator MBBI, MBBE;
+ for (MBBI = MBB->begin(), MBBE = MBB->end(); MBBI!=MBBE; ++MBBI) {
+ if (!MBBI->isDebugValue())
+ break;
+ }
+ return (MBBI->getDesc().isBranch());
+}
+
/// IsBetterFallthrough - Return true if it would be clearly better to
/// fall-through to MBB1 than to fall through into MBB2. This has to return
/// a strict ordering, returning true for both (MBB1,MBB2) and (MBB2,MBB1) will
@@ -1206,7 +1217,7 @@
// If this branch is the only thing in its block, see if we can forward
// other blocks across it.
if (CurTBB && CurCond.empty() && CurFBB == 0 &&
- MBB->begin()->getDesc().isBranch() && CurTBB != MBB &&
+ IsBranchOnlyBlock(MBB) && CurTBB != MBB &&
!MBB->hasAddressTaken()) {
// This block may contain just an unconditional branch. Because there can
// be 'non-branch terminators' in the block, try removing the branch and
More information about the llvm-commits
mailing list