[llvm-commits] [llvm] r100062 - /llvm/trunk/lib/CodeGen/MachineBasicBlock.cpp
Bob Wilson
bob.wilson at apple.com
Wed Mar 31 16:38:06 PDT 2010
Are you sure? I think that's the same test that's been failing intermittently. Daniel tried to fix it (see http://llvm.org/bugs/show_bug.cgi?id=6753) but I think I also saw a comment from him that it wasn't really fixed.
On Mar 31, 2010, at 4:26 PM, Bill Wendling wrote:
> Author: void
> Date: Wed Mar 31 18:26:26 2010
> New Revision: 100062
>
> URL: http://llvm.org/viewvc/llvm-project?rev=100062&view=rev
> Log:
> Revert r100056. It was causing a failure on MSVC.
>
> Modified:
> llvm/trunk/lib/CodeGen/MachineBasicBlock.cpp
>
> Modified: llvm/trunk/lib/CodeGen/MachineBasicBlock.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineBasicBlock.cpp?rev=100062&r1=100061&r2=100062&view=diff
> ==============================================================================
> --- llvm/trunk/lib/CodeGen/MachineBasicBlock.cpp (original)
> +++ llvm/trunk/lib/CodeGen/MachineBasicBlock.cpp Wed Mar 31 18:26:26 2010
> @@ -23,7 +23,6 @@
> #include "llvm/Target/TargetMachine.h"
> #include "llvm/Assembly/Writer.h"
> #include "llvm/ADT/SmallString.h"
> -#include "llvm/ADT/SmallPtrSet.h"
> #include "llvm/Support/Debug.h"
> #include "llvm/Support/LeakDetector.h"
> #include "llvm/Support/raw_ostream.h"
> @@ -460,41 +459,54 @@
> // conditional branch followed by an unconditional branch. DestA is the
> // 'true' destination and DestB is the 'false' destination.
>
> - bool Changed = false;
> + bool MadeChange = false;
> + bool AddedFallThrough = false;
>
> MachineFunction::iterator FallThru =
> llvm::next(MachineFunction::iterator(this));
> -
> - if (DestA == 0 && DestB == 0) {
> - // Block falls through to successor.
> - DestA = FallThru;
> - DestB = FallThru;
> - } else if (DestA != 0 && DestB == 0) {
> - if (isCond)
> - // Block ends in conditional jump that falls through to successor.
> +
> + if (isCond) {
> + // If this block ends with a conditional branch that falls through to its
> + // successor, set DestB as the successor.
> + if (DestB == 0 && FallThru != getParent()->end()) {
> DestB = FallThru;
> + AddedFallThrough = true;
> + }
> } else {
> - assert(DestA && DestB && isCond &&
> - "CFG in a bad state. Cannot correct CFG edges");
> + // If this is an unconditional branch with no explicit dest, it must just be
> + // a fallthrough into DestA.
> + if (DestA == 0 && FallThru != getParent()->end()) {
> + DestA = FallThru;
> + AddedFallThrough = true;
> + }
> }
> -
> - // Remove superfluous edges. I.e., those which aren't destinations of this
> - // basic block, duplicate edges, or landing pads.
> - SmallPtrSet<const MachineBasicBlock*, 8> SeenMBBs;
> +
> MachineBasicBlock::succ_iterator SI = succ_begin();
> + MachineBasicBlock *OrigDestA = DestA, *OrigDestB = DestB;
> while (SI != succ_end()) {
> const MachineBasicBlock *MBB = *SI;
> - if (!SeenMBBs.insert(MBB) ||
> - (MBB != DestA && MBB != DestB && !MBB->isLandingPad())) {
> - // This is a superfluous edge, remove it.
> - SI = removeSuccessor(SI);
> - Changed = true;
> - } else {
> + if (MBB == DestA) {
> + DestA = 0;
> + ++SI;
> + } else if (MBB == DestB) {
> + DestB = 0;
> + ++SI;
> + } else if (MBB->isLandingPad() &&
> + MBB != OrigDestA && MBB != OrigDestB) {
> ++SI;
> + } else {
> + // Otherwise, this is a superfluous edge, remove it.
> + SI = removeSuccessor(SI);
> + MadeChange = true;
> }
> }
>
> - return Changed;
> + if (!AddedFallThrough)
> + assert(DestA == 0 && DestB == 0 && "MachineCFG is missing edges!");
> + else if (isCond)
> + assert(DestA == 0 && "MachineCFG is missing edges!");
> +
> + return MadeChange;
> }
>
> /// findDebugLoc - find the next valid DebugLoc starting at MBBI, skipping
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20100331/8e47f769/attachment.html>
More information about the llvm-commits
mailing list