[llvm-commits] [llvm] r71018 - in /llvm/trunk: lib/CodeGen/IfConversion.cpp lib/CodeGen/MachineBasicBlock.cpp test/CodeGen/X86/omit-label.ll
Dan Gohman
gohman at apple.com
Tue May 5 14:10:53 PDT 2009
Author: djg
Date: Tue May 5 16:10:19 2009
New Revision: 71018
URL: http://llvm.org/viewvc/llvm-project?rev=71018&view=rev
Log:
If a MachineBasicBlock has multiple ways of reaching another block,
allow it to have multiple CFG edges to that block. This is needed
to allow MachineBasicBlock::isOnlyReachableByFallthrough to work
correctly. This fixes PR4126.
Added:
llvm/trunk/test/CodeGen/X86/omit-label.ll
Modified:
llvm/trunk/lib/CodeGen/IfConversion.cpp
llvm/trunk/lib/CodeGen/MachineBasicBlock.cpp
Modified: llvm/trunk/lib/CodeGen/IfConversion.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/IfConversion.cpp?rev=71018&r1=71017&r2=71018&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/IfConversion.cpp (original)
+++ llvm/trunk/lib/CodeGen/IfConversion.cpp Tue May 5 16:10:19 2009
@@ -1174,8 +1174,7 @@
// Fallthrough edge can't be transferred.
if (Succ == FallThrough)
continue;
- if (!ToBBI.BB->isSuccessor(Succ))
- ToBBI.BB->addSuccessor(Succ);
+ ToBBI.BB->addSuccessor(Succ);
}
std::copy(FromBBI.Predicate.begin(), FromBBI.Predicate.end(),
@@ -1215,12 +1214,11 @@
if (Succ == FallThrough)
continue;
FromBBI.BB->removeSuccessor(Succ);
- if (!ToBBI.BB->isSuccessor(Succ))
- ToBBI.BB->addSuccessor(Succ);
+ ToBBI.BB->addSuccessor(Succ);
}
// Now FromBBI always fall through to the next block!
- if (NBB && !FromBBI.BB->isSuccessor(NBB))
+ if (NBB)
FromBBI.BB->addSuccessor(NBB);
std::copy(FromBBI.Predicate.begin(), FromBBI.Predicate.end(),
Modified: llvm/trunk/lib/CodeGen/MachineBasicBlock.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineBasicBlock.cpp?rev=71018&r1=71017&r2=71018&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/MachineBasicBlock.cpp (original)
+++ llvm/trunk/lib/CodeGen/MachineBasicBlock.cpp Tue May 5 16:10:19 2009
@@ -305,11 +305,9 @@
I->getOperand(i).setMBB(New);
}
- // Update the successor information. If New was already a successor, just
- // remove the link to Old instead of creating another one. PR 1444.
+ // Update the successor information.
removeSuccessor(Old);
- if (!isSuccessor(New))
- addSuccessor(New);
+ addSuccessor(New);
}
/// CorrectExtraCFGEdges - Various pieces of code can cause excess edges in the
Added: llvm/trunk/test/CodeGen/X86/omit-label.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/omit-label.ll?rev=71018&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/X86/omit-label.ll (added)
+++ llvm/trunk/test/CodeGen/X86/omit-label.ll Tue May 5 16:10:19 2009
@@ -0,0 +1,23 @@
+; RUN: llvm-as < %s | llc -march=x86-64 | grep BB1_1:
+; PR4126
+
+; Don't omit this label's definition.
+
+define void @bux(i32 %p_53) nounwind optsize {
+entry:
+ %0 = icmp eq i32 %p_53, 0 ; <i1> [#uses=1]
+ %1 = icmp sgt i32 %p_53, 0 ; <i1> [#uses=1]
+ %or.cond = and i1 %0, %1 ; <i1> [#uses=1]
+ br i1 %or.cond, label %bb.i, label %bb3
+
+bb.i: ; preds = %entry
+ %2 = add i32 %p_53, 1 ; <i32> [#uses=1]
+ %3 = icmp slt i32 %2, 0 ; <i1> [#uses=0]
+ br label %bb3
+
+bb3: ; preds = %bb.i, %entry
+ %4 = tail call i32 (...)* @baz(i32 0) nounwind ; <i32> [#uses=0]
+ ret void
+}
+
+declare i32 @baz(...)
More information about the llvm-commits
mailing list