From: Jakob Stoklund Olesen Date: Mon, 7 Nov 2011 21:59:29 +0000 (+0000) Subject: Use a reverse post order instead of a DFS order. X-Git-Tag: android-x86-6.0-r1~402 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=16fb58ad0ba061c7059b1cb5fd53a9b46a33d5c3;p=android-x86%2Fexternal-llvm.git Use a reverse post order instead of a DFS order. The enterBasicBlock() function is combining live-out values from predecessor blocks. The RPO traversal means that more predecessors have been visited when that happens, only back-edges are missing. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@144025 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/CodeGen/ExecutionDepsFix.cpp b/lib/CodeGen/ExecutionDepsFix.cpp index 8b002e76672..3d6f256dd8e 100644 --- a/lib/CodeGen/ExecutionDepsFix.cpp +++ b/lib/CodeGen/ExecutionDepsFix.cpp @@ -26,7 +26,7 @@ #include "llvm/CodeGen/Passes.h" #include "llvm/Target/TargetInstrInfo.h" #include "llvm/Target/TargetMachine.h" -#include "llvm/ADT/DepthFirstIterator.h" +#include "llvm/ADT/PostOrderIterator.h" #include "llvm/Support/Allocator.h" #include "llvm/Support/Debug.h" #include "llvm/Support/raw_ostream.h" @@ -499,11 +499,10 @@ bool ExeDepsFix::runOnMachineFunction(MachineFunction &mf) { } MachineBasicBlock *Entry = MF->begin(); - SmallPtrSet Visited; - for (df_ext_iterator > - DFI = df_ext_begin(Entry, Visited), DFE = df_ext_end(Entry, Visited); - DFI != DFE; ++DFI) { - MachineBasicBlock *MBB = *DFI; + ReversePostOrderTraversal RPOT(Entry); + for (ReversePostOrderTraversal::rpo_iterator + MBBI = RPOT.begin(), MBBE = RPOT.end(); MBBI != MBBE; ++MBBI) { + MachineBasicBlock *MBB = *MBBI; enterBasicBlock(MBB); for (MachineBasicBlock::iterator I = MBB->begin(), E = MBB->end(); I != E; ++I)