llvm-6502/lib/CodeGen
Chris Lattner ffddf6ba1c Enable deleting branches to successor blocks. With the previous patches,
branch folding can now compile stuff like this:

void foo(int W, int X, int Y, int Z) {
  if (W & 1) {
    for (; X;--X) bar();
  } else if (W & 2) {
    for (; Y;--Y) bar();
  } else if (W & 4) {
    for (; Z;--Z) bar();
  } else if (W & 8) {
    for (; W;--W) bar();
  }

  if (W) {
    bar();
  }
}

contrived testcase where loops exits all end up merging together.  To have
the loop merges be:

...
        cmplw cr0, r30, r27
        bne cr0, LBB1_14        ;bb38
LBB1_16:        ;cond_next48.loopexit
        mr r27, r29
LBB1_20:        ;cond_next48
        cmplwi cr0, r27, 0
        beq cr0, LBB1_22        ;UnifiedReturnBlock
...

instead of:


...
        cmplw cr0, r30, r27
        bne cr0, LBB1_14        ;bb38
LBB1_16:        ;cond_next48.loopexit
        mr r27, r29
        b LBB1_20       ;cond_next48
LBB1_17:        ;cond_next48.loopexit1
        b LBB1_20       ;cond_next48
LBB1_18:        ;cond_next48.loopexit2
        b LBB1_20       ;cond_next48
LBB1_19:        ;cond_next48.loopexit3
LBB1_20:        ;cond_next48
        cmplwi cr0, r27, 0
        beq cr0, LBB1_22        ;UnifiedReturnBlock
...


This is CodeGen/PowerPC/branch-opt.ll


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31006 91177308-0d34-0410-b5e6-96231b3b80d8
2006-10-17 18:16:40 +00:00
..
SelectionDAG Make sure operand does have size and element type operands. 2006-10-17 17:06:35 +00:00
AsmPrinter.cpp Clean up interface to getGlobalLinkName. 2006-10-17 17:17:24 +00:00
BranchFolding.cpp Enable deleting branches to successor blocks. With the previous patches, 2006-10-17 18:16:40 +00:00
DwarfWriter.cpp Clean up interface to getGlobalLinkName. 2006-10-17 17:17:24 +00:00
ELFWriter.cpp
IntrinsicLowering.cpp
LiveInterval.cpp
LiveIntervalAnalysis.cpp
LiveVariables.cpp Fix for PR929. The PHI nodes were being gone through for each instruction 2006-10-03 07:20:20 +00:00
LLVMTargetMachine.cpp add the branch folding pass as a late cleanup pass for all targets. For now 2006-10-13 20:45:56 +00:00
MachineBasicBlock.cpp print labels even if a MBB doesn't have a corresponding LLVM BB, just don't 2006-10-06 21:28:17 +00:00
MachineDebugInfo.cpp Clean up dump. 2006-10-13 13:01:34 +00:00
MachineFunction.cpp Bugfixes 2006-10-03 20:19:23 +00:00
MachineInstr.cpp
MachinePassRegistry.cpp
MachOWriter.cpp
Makefile
Passes.cpp
PHIElimination.cpp "Once more into the breach, dear friends, once more, or fill the wall up 2006-09-28 07:10:24 +00:00
PhysRegTracker.h
PrologEpilogInserter.cpp TargetRegisterClass specifies the desired spill alignment. However, it cannot be honored if stack alignment is smaller. 2006-09-28 18:52:32 +00:00
RegAllocLinearScan.cpp
RegAllocLocal.cpp Fix UnitTests/2005-05-12-Int64ToFP.c with llc-beta. In particular, do not 2006-09-19 18:02:01 +00:00
RegAllocSimple.cpp
TwoAddressInstructionPass.cpp
UnreachableBlockElim.cpp
VirtRegMap.cpp restore my previous patch, now that the X86 backend bug has been fixed: 2006-10-12 17:45:38 +00:00
VirtRegMap.h