<div class="gmail_quote">On Sun, Oct 23, 2011 at 3:56 AM, Roman Divacky <span dir="ltr"><<a href="mailto:rdivacky@freebsd.org">rdivacky@freebsd.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
I enabled your MachineBlockPlacement pass by default and ran perlbench.<br>
<br>
Your pass gets perl from 94% (of gcc4.2.1 compiled one performance) to 96%.<br>
Great work!<br></blockquote><div><br></div><div>That's actually rather surprising. The probabilities we're basing any of this on are quite broken. But hey, I'm glad it's improving things. What hardware? How stable were the numbers?</div>
<div>Â </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div class="HOEnZb"><div class="h5"><br>
On Sun, Oct 23, 2011 at 09:18:45AM -0000, Chandler Carruth wrote:<br>
> Author: chandlerc<br>
> Date: Sun Oct 23 04:18:45 2011<br>
> New Revision: 142743<br>
><br>
> URL: <a href="http://llvm.org/viewvc/llvm-project?rev=142743&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=142743&view=rev</a><br>
> Log:<br>
> Completely re-write the algorithm behind MachineBlockPlacement based on<br>
> discussions with Andy. Fundamentally, the previous algorithm is both<br>
> counter productive on several fronts and prioritizing things which<br>
> aren't necessarily the most important: static branch prediction.<br>
><br>
> The new algorithm uses the existing loop CFG structure information to<br>
> walk through the CFG itself to layout blocks. It coalesces adjacent<br>
> blocks within the loop where the CFG allows based on the most likely<br>
> path taken. Finally, it topologically orders the block chains that have<br>
> been formed. This allows it to choose a (mostly) topologically valid<br>
> ordering which still priorizes fallthrough within the structural<br>
> constraints.<br>
><br>
> As a final twist in the algorithm, it does violate the CFG when it<br>
> discovers a "hot" edge, that is an edge that is more than 4x hotter than<br>
> the competing edges in the CFG. These are forcibly merged into<br>
> a fallthrough chain.<br>
><br>
> Future transformations that need te be added are rotation of loop exit<br>
> conditions to be fallthrough, and better isolation of cold block chains.<br>
> I'm also planning on adding statistics to model how well the algorithm<br>
> does at laying out blocks based on the probabilities it receives.<br>
><br>
> The old tests mostly still pass, and I have some new tests to add, but<br>
> the nested loops are still behaving very strangely. This almost seems<br>
> like working-as-intended as it rotated the exit branch to be<br>
> fallthrough, but I'm not convinced this is actually the best layout. It<br>
> is well supported by the probabilities for loops we currently get, but<br>
> those are pretty broken for nested loops, so this may change later.<br>
><br>
> Modified:<br>
> Â Â llvm/trunk/lib/CodeGen/MachineBlockPlacement.cpp<br>
> Â Â llvm/trunk/test/CodeGen/X86/block-placement.ll<br>
><br>
> Modified: llvm/trunk/lib/CodeGen/MachineBlockPlacement.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineBlockPlacement.cpp?rev=142743&r1=142742&r2=142743&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineBlockPlacement.cpp?rev=142743&r1=142742&r2=142743&view=diff</a><br>
> ==============================================================================<br>
> --- llvm/trunk/lib/CodeGen/MachineBlockPlacement.cpp (original)<br>
> +++ llvm/trunk/lib/CodeGen/MachineBlockPlacement.cpp Sun Oct 23 04:18:45 2011<br>
> @@ -7,15 +7,21 @@<br>
> Â //<br>
> Â //===----------------------------------------------------------------------===//<br>
> Â //<br>
> -// This file implements basic block placement transformations using branch<br>
> -// probability estimates. It is based around "Algo2" from Profile Guided Code<br>
> -// Positioning [<a href="http://portal.acm.org/citation.cfm?id=989433" target="_blank">http://portal.acm.org/citation.cfm?id=989433</a>].<br>
> +// This file implements basic block placement transformations using the CFG<br>
> +// structure and branch probability estimates.<br>
> Â //<br>
> -// We combine the BlockFrequencyInfo with BranchProbabilityInfo to simulate<br>
> -// measured edge-weights. The BlockFrequencyInfo effectively summarizes the<br>
> -// probability of starting from any particular block, and the<br>
> -// BranchProbabilityInfo the probability of exiting the block via a particular<br>
> -// edge. Combined they form a function-wide ordering of the edges.<br>
> +// The pass strives to preserve the structure of the CFG (that is, retain<br>
> +// a topological ordering of basic blocks) in the absense of a *strong* signal<br>
> +// to the contrary from probabilities. However, within the CFG structure, it<br>
> +// attempts to choose an ordering which favors placing more likely sequences of<br>
> +// blocks adjacent to each other.<br>
> +//<br>
> +// The algorithm works from the inner-most loop within a function outward, and<br>
> +// at each stage walks through the basic blocks, trying to coalesce them into<br>
> +// sequential chains where allowed by the CFG (or demanded by heavy<br>
> +// probabilities). Finally, it walks the blocks in topological order, and the<br>
> +// first time it reaches a chain of basic blocks, it schedules them in the<br>
> +// function in-order.<br>
> Â //<br>
> Â //===----------------------------------------------------------------------===//<br>
><br>
> @@ -29,8 +35,10 @@<br>
> Â #include "llvm/CodeGen/MachineModuleInfo.h"<br>
> Â #include "llvm/CodeGen/Passes.h"<br>
> Â #include "llvm/Support/Allocator.h"<br>
> +#include "llvm/Support/Debug.h"<br>
> Â #include "llvm/Support/ErrorHandling.h"<br>
> Â #include "llvm/ADT/DenseMap.h"<br>
> +#include "llvm/ADT/PostOrderIterator.h"<br>
> Â #include "llvm/ADT/SCCIterator.h"<br>
> Â #include "llvm/ADT/SmallPtrSet.h"<br>
> Â #include "llvm/ADT/SmallVector.h"<br>
> @@ -57,7 +65,7 @@<br>
> Â }<br>
><br>
> Â namespace {<br>
> -struct BlockChain;<br>
> +class BlockChain;<br>
> Â /// \brief Type for our function-wide basic block -> block chain mapping.<br>
> Â typedef DenseMap<MachineBasicBlock *, BlockChain *> BlockToChainMapType;<br>
> Â }<br>
> @@ -78,22 +86,12 @@<br>
> Â /// The block chains also have support for calculating and caching probability<br>
> Â /// information related to the chain itself versus other chains. This is used<br>
> Â /// for ranking during the final layout of block chains.<br>
> -struct BlockChain {<br>
> - Â class SuccIterator;<br>
> -<br>
> - Â /// \brief The first and last basic block that from this chain.<br>
> - Â ///<br>
> - Â /// The chain is stored within the existing function ilist of basic blocks.<br>
> - Â /// When merging chains or otherwise manipulating them, we splice the blocks<br>
> - Â /// within this ilist, giving us very cheap storage here and constant time<br>
> - Â /// merge operations.<br>
> +class BlockChain {<br>
> + Â /// \brief The sequence of blocks belonging to this chain.<br>
> Â Â ///<br>
> - Â /// It is extremely important to note that LastBB is the iterator pointing<br>
> - Â /// *at* the last basic block in the chain. That is, the chain consists of<br>
> - Â /// the *closed* range [FirstBB, LastBB]. We cannot use half-open ranges<br>
> - Â /// because the next basic block may get relocated to a different part of the<br>
> - Â /// function at any time during the run of this pass.<br>
> - Â MachineFunction::iterator FirstBB, LastBB;<br>
> + Â /// This is the sequence of blocks for a particular chain. These will be laid<br>
> + Â /// out in-order within the function.<br>
> + Â SmallVector<MachineBasicBlock *, 4> Blocks;<br>
><br>
> Â Â /// \brief A handle to the function-wide basic block to block chain mapping.<br>
> Â Â ///<br>
> @@ -103,158 +101,66 @@<br>
> Â Â /// structure.<br>
> Â Â BlockToChainMapType &BlockToChain;<br>
><br>
> - Â /// \brief The weight used to rank two block chains in the same SCC.<br>
> - Â ///<br>
> - Â /// This is used during SCC layout of block chains to cache and rank the<br>
> - Â /// chains. It is supposed to represent the expected frequency with which<br>
> - Â /// control reaches a block within this chain, has the option of branching to<br>
> - Â /// a block in some other chain participating in the SCC, but instead<br>
> - Â /// continues within this chain. The higher this is, the more costly we<br>
> - Â /// expect mis-predicted branches between this chain and other chains within<br>
> - Â /// the SCC to be. Thus, since we expect branches between chains to be<br>
> - Â /// predicted when backwards and not predicted when forwards, the higher this<br>
> - Â /// is the more important that this chain is laid out first among those<br>
> - Â /// chains in the same SCC as it.<br>
> - Â BlockFrequency InChainEdgeFrequency;<br>
> -<br>
> +public:<br>
> Â Â /// \brief Construct a new BlockChain.<br>
> Â Â ///<br>
> Â Â /// This builds a new block chain representing a single basic block in the<br>
> Â Â /// function. It also registers itself as the chain that block participates<br>
> Â Â /// in with the BlockToChain mapping.<br>
> Â Â BlockChain(BlockToChainMapType &BlockToChain, MachineBasicBlock *BB)<br>
> - Â Â : FirstBB(BB), LastBB(BB), BlockToChain(BlockToChain) {<br>
> + Â Â : Blocks(1, BB), BlockToChain(BlockToChain) {<br>
> Â Â Â assert(BB && "Cannot create a chain with a null basic block");<br>
> Â Â Â BlockToChain[BB] = this;<br>
> Â Â }<br>
><br>
> - Â /// \brief Merge another block chain into this one.<br>
> + Â /// \brief Iterator over blocks within the chain.<br>
> + Â typedef SmallVectorImpl<MachineBasicBlock *>::const_iterator iterator;<br>
> +<br>
> + Â /// \brief Beginning of blocks within the chain.<br>
> + Â iterator begin() const { return Blocks.begin(); }<br>
> +<br>
> + Â /// \brief End of blocks within the chain.<br>
> + Â iterator end() const { return Blocks.end(); }<br>
> +<br>
> + Â /// \brief Merge a block chain into this one.<br>
> Â Â ///<br>
> Â Â /// This routine merges a block chain into this one. It takes care of forming<br>
> Â Â /// a contiguous sequence of basic blocks, updating the edge list, and<br>
> Â Â /// updating the block -> chain mapping. It does not free or tear down the<br>
> Â Â /// old chain, but the old chain's block list is no longer valid.<br>
> - Â void merge(BlockChain *Chain) {<br>
> - Â Â assert(Chain && "Cannot merge a null chain");<br>
> - Â Â MachineFunction::iterator EndBB = llvm::next(LastBB);<br>
> - Â Â MachineFunction::iterator ChainEndBB = llvm::next(Chain->LastBB);<br>
> -<br>
> - Â Â // Update the incoming blocks to point to this chain.<br>
> - Â Â for (MachineFunction::iterator BI = Chain->FirstBB, BE = ChainEndBB;<br>
> - Â Â Â Â BI != BE; ++BI) {<br>
> - Â Â Â assert(BlockToChain[BI] == Chain && "Incoming blocks not in chain");<br>
> - Â Â Â BlockToChain[BI] = this;<br>
> + Â void merge(MachineBasicBlock *BB, BlockChain *Chain) {<br>
> + Â Â assert(BB);<br>
> + Â Â assert(!Blocks.empty());<br>
> + Â Â assert(Blocks.back()->isSuccessor(BB));<br>
> +<br>
> + Â Â // Fast path in case we don't have a chain already.<br>
> + Â Â if (!Chain) {<br>
> + Â Â Â assert(!BlockToChain[BB]);<br>
> + Â Â Â Blocks.push_back(BB);<br>
> + Â Â Â BlockToChain[BB] = this;<br>
> + Â Â Â return;<br>
> Â Â Â }<br>
><br>
> - Â Â // We splice the blocks together within the function (unless they already<br>
> - Â Â // are adjacent) so we can represent the new chain with a pair of pointers<br>
> - Â Â // to basic blocks within the function. This is also useful as each chain<br>
> - Â Â // of blocks will end up being laid out contiguously within the function.<br>
> - Â Â if (EndBB != Chain->FirstBB)<br>
> - Â Â Â FirstBB->getParent()->splice(EndBB, Chain->FirstBB, ChainEndBB);<br>
> - Â Â LastBB = Chain->LastBB;<br>
> - Â }<br>
> -};<br>
> -}<br>
> -<br>
> -namespace {<br>
> -/// \brief Successor iterator for BlockChains.<br>
> -///<br>
> -/// This is an iterator that walks over the successor block chains by looking<br>
> -/// through its blocks successors and mapping those back to block chains. This<br>
> -/// iterator is not a fully-functioning iterator, it is designed specifically<br>
> -/// to support the interface required by SCCIterator when forming and walking<br>
> -/// SCCs of BlockChains.<br>
> -///<br>
> -/// Note that this iterator cannot be used while the chains are still being<br>
> -/// formed and/or merged. Unlike the chains themselves, it does store end<br>
> -/// iterators which could be moved if the chains are re-ordered. Once we begin<br>
> -/// forming and iterating over an SCC of chains, the order of blocks within the<br>
> -/// function must not change until we finish using the SCC iterators.<br>
> -class BlockChain::SuccIterator<br>
> - Â Â : public std::iterator<std::forward_iterator_tag,<br>
> - Â Â Â Â Â Â Â Â Â Â Â Â Â BlockChain *, ptrdiff_t> {<br>
> - Â BlockChain *Chain;<br>
> - Â MachineFunction::iterator BI, BE;<br>
> - Â MachineBasicBlock::succ_iterator SI;<br>
> + Â Â assert(BB == *Chain->begin());<br>
> + Â Â assert(Chain->begin() != Chain->end());<br>
><br>
> -public:<br>
> - Â explicit SuccIterator(BlockChain *Chain)<br>
> - Â Â : Chain(Chain), BI(Chain->FirstBB), BE(llvm::next(Chain->LastBB)),<br>
> - Â Â Â SI(BI->succ_begin()) {<br>
> - Â Â while (BI != BE && BI->succ_begin() == BI->succ_end())<br>
> - Â Â Â ++BI;<br>
> - Â Â if (BI != BE)<br>
> - Â Â Â SI = BI->succ_begin();<br>
> - Â }<br>
> -<br>
> - Â /// \brief Helper function to create an end iterator for a particular chain.<br>
> - Â ///<br>
> - Â /// The "end" state is extremely arbitrary. We chose to have BI == BE, and SI<br>
> - Â /// == Chain->FirstBB->succ_begin(). The value of SI doesn't really make any<br>
> - Â /// sense, but rather than try to rationalize SI and our increment, when we<br>
> - Â /// detect an "end" state, we just immediately call this function to build<br>
> - Â /// the canonical end iterator.<br>
> - Â static SuccIterator CreateEnd(BlockChain *Chain) {<br>
> - Â Â SuccIterator It(Chain);<br>
> - Â Â It.BI = It.BE;<br>
> - Â Â return It;<br>
> - Â }<br>
> -<br>
> - Â bool operator==(const SuccIterator &RHS) const {<br>
> - Â Â return (Chain == RHS.Chain && BI == <a href="http://RHS.BI" target="_blank">RHS.BI</a> && SI == <a href="http://RHS.SI" target="_blank">RHS.SI</a>);<br>
> - Â }<br>
> - Â bool operator!=(const SuccIterator &RHS) const {<br>
> - Â Â return !operator==(RHS);<br>
> - Â }<br>
> -<br>
> - Â SuccIterator& operator++() {<br>
> - Â Â assert(*this != CreateEnd(Chain) && "Cannot increment the end iterator");<br>
> - Â Â // There may be null successor pointers, skip over them.<br>
> - Â Â // FIXME: I don't understand *why* there are null successor pointers.<br>
> - Â Â do {<br>
> - Â Â Â ++SI;<br>
> - Â Â Â if (SI != BI->succ_end() && *SI)<br>
> - Â Â Â Â return *this;<br>
> -<br>
> - Â Â Â // There may be a basic block without successors. Skip over them.<br>
> - Â Â Â do {<br>
> - Â Â Â Â ++BI;<br>
> - Â Â Â Â if (BI == BE)<br>
> - Â Â Â Â Â return *this = CreateEnd(Chain);<br>
> - Â Â Â } while (BI->succ_begin() == BI->succ_end());<br>
> - Â Â Â SI = BI->succ_begin();<br>
> - Â Â } while (!*SI);<br>
> - Â Â return *this;<br>
> - Â }<br>
> - Â SuccIterator operator++(int) {<br>
> - Â Â SuccIterator tmp = *this;<br>
> - Â Â ++*this;<br>
> - Â Â return tmp;<br>
> - Â }<br>
> -<br>
> - Â BlockChain *operator*() const {<br>
> - Â Â assert(Chain->BlockToChain.lookup(*SI) && "Missing chain");<br>
> - Â Â return Chain->BlockToChain.lookup(*SI);<br>
> - Â }<br>
> -};<br>
> -}<br>
> -<br>
> -namespace {<br>
> -/// \brief Sorter used with containers of BlockChain pointers.<br>
> -///<br>
> -/// Sorts based on the \see BlockChain::InChainEdgeFrequency -- see its<br>
> -/// comments for details on what this ordering represents.<br>
> -struct ChainPtrPrioritySorter {<br>
> - Â bool operator()(const BlockChain *LHS, const BlockChain *RHS) const {<br>
> - Â Â assert(LHS && RHS && "Null chain entry");<br>
> - Â Â return LHS->InChainEdgeFrequency < RHS->InChainEdgeFrequency;<br>
> + Â Â // Update the incoming blocks to point to this chain, and add them to the<br>
> + Â Â // chain structure.<br>
> + Â Â for (BlockChain::iterator BI = Chain->begin(), BE = Chain->end();<br>
> + Â Â Â Â BI != BE; ++BI) {<br>
> + Â Â Â Blocks.push_back(*BI);<br>
> + Â Â Â assert(BlockToChain[*BI] == Chain && "Incoming blocks not in chain");<br>
> + Â Â Â BlockToChain[*BI] = this;<br>
> + Â Â }<br>
> Â Â }<br>
> Â };<br>
> Â }<br>
><br>
> Â namespace {<br>
> Â class MachineBlockPlacement : public MachineFunctionPass {<br>
> + Â /// \brief A typedef for a block filter set.<br>
> + Â typedef SmallPtrSet<MachineBasicBlock *, 16> BlockFilterSet;<br>
> +<br>
> Â Â /// \brief A handle to the branch probability pass.<br>
> Â Â const MachineBranchProbabilityInfo *MBPI;<br>
><br>
> @@ -270,17 +176,6 @@<br>
> Â Â /// \brief A handle to the target's lowering info.<br>
> Â Â const TargetLowering *TLI;<br>
><br>
> - Â /// \brief A prioritized list of edges in the BB-graph.<br>
> - Â ///<br>
> - Â /// For each function, we insert all control flow edges between BBs, along<br>
> - Â /// with their "global" frequency. The Frequency of an edge being taken is<br>
> - Â /// defined as the frequency of entering the source BB (from MBFI) times the<br>
> - Â /// probability of taking a particular branch out of that block (from MBPI).<br>
> - Â ///<br>
> - Â /// Once built, this list is sorted in ascending frequency, making the last<br>
> - Â /// edge the hottest one in the function.<br>
> - Â SmallVector<WeightedEdge, 64> Edges;<br>
> -<br>
> Â Â /// \brief Allocator and owner of BlockChain structures.<br>
> Â Â ///<br>
> Â Â /// We build BlockChains lazily by merging together high probability BB<br>
> @@ -297,24 +192,12 @@<br>
> Â Â /// between basic blocks.<br>
> Â Â DenseMap<MachineBasicBlock *, BlockChain *> BlockToChain;<br>
><br>
> - Â /// \brief A prioritized sequence of chains.<br>
> - Â ///<br>
> - Â /// We build up the ideal sequence of basic block chains in reverse order<br>
> - Â /// here, and then walk backwards to arrange the final function ordering.<br>
> - Â SmallVector<BlockChain *, 16> PChains;<br>
> -<br>
> -#ifndef NDEBUG<br>
> - Â /// \brief A set of active chains used to sanity-check the pass algorithm.<br>
> - Â ///<br>
> - Â /// All operations on this member should be wrapped in an assert or NDEBUG.<br>
> - Â SmallPtrSet<BlockChain *, 16> ActiveChains;<br>
> -#endif<br>
> -<br>
> Â Â BlockChain *CreateChain(MachineBasicBlock *BB);<br>
> - Â void PrioritizeEdges(MachineFunction &F);<br>
> - Â void BuildBlockChains();<br>
> - Â void PrioritizeChains(MachineFunction &F);<br>
> - Â void PlaceBlockChains(MachineFunction &F);<br>
> + Â void mergeSuccessor(MachineBasicBlock *BB, BlockChain *Chain,<br>
> + Â Â Â Â Â Â Â Â Â Â Â BlockFilterSet *Filter = 0);<br>
> + Â void buildLoopChains(MachineFunction &F, MachineLoop &L);<br>
> + Â void buildCFGChains(MachineFunction &F);<br>
> + Â void placeChainsTopologically(MachineFunction &F);<br>
> Â Â void AlignLoops(MachineFunction &F);<br>
><br>
> Â public:<br>
> @@ -349,21 +232,30 @@<br>
> Â Â return new MachineBlockPlacement();<br>
> Â }<br>
><br>
> -namespace llvm {<br>
> -/// \brief GraphTraits specialization for our BlockChain graph.<br>
> -template <> struct GraphTraits<BlockChain *> {<br>
> - Â typedef BlockChain NodeType;<br>
> - Â typedef BlockChain::SuccIterator ChildIteratorType;<br>
> -<br>
> - Â static NodeType *getEntryNode(NodeType *N) { return N; }<br>
> - Â static BlockChain::SuccIterator child_begin(NodeType *N) {<br>
> - Â Â return BlockChain::SuccIterator(N);<br>
> - Â }<br>
> - Â static BlockChain::SuccIterator child_end(NodeType *N) {<br>
> - Â Â return BlockChain::SuccIterator::CreateEnd(N);<br>
> - Â }<br>
> -};<br>
> +#ifndef NDEBUG<br>
> +/// \brief Helper to print the name of a MBB.<br>
> +///<br>
> +/// Only used by debug logging.<br>
> +static std::string getBlockName(MachineBasicBlock *BB) {<br>
> + Â std::string Result;<br>
> + Â raw_string_ostream OS(Result);<br>
> + Â OS << "BB#" << BB->getNumber()<br>
> + Â Â << " (derived from LLVM BB '" << BB->getName() << "')";<br>
> + Â OS.flush();<br>
> + Â return Result;<br>
> +}<br>
> +<br>
> +/// \brief Helper to print the number of a MBB.<br>
> +///<br>
> +/// Only used by debug logging.<br>
> +static std::string getBlockNum(MachineBasicBlock *BB) {<br>
> + Â std::string Result;<br>
> + Â raw_string_ostream OS(Result);<br>
> + Â OS << "BB#" << BB->getNumber();<br>
> + Â OS.flush();<br>
> + Â return Result;<br>
> Â }<br>
> +#endif<br>
><br>
> Â /// \brief Helper to create a new chain for a single BB.<br>
> Â ///<br>
> @@ -373,224 +265,168 @@<br>
> Â BlockChain *MachineBlockPlacement::CreateChain(MachineBasicBlock *BB) {<br>
> Â Â BlockChain *Chain =<br>
> Â Â Â new (ChainAllocator.Allocate()) BlockChain(BlockToChain, BB);<br>
> - Â assert(ActiveChains.insert(Chain));<br>
> + Â //assert(ActiveChains.insert(Chain));<br>
> Â Â return Chain;<br>
> Â }<br>
><br>
> -/// \brief Build a prioritized list of edges.<br>
> +/// \brief Merge a chain with any viable successor.<br>
> Â ///<br>
> -/// The priority is determined by the product of the block frequency (how<br>
> -/// likely it is to arrive at a particular block) times the probability of<br>
> -/// taking this particular edge out of the block. This provides a function-wide<br>
> -/// ordering of the edges.<br>
> -void MachineBlockPlacement::PrioritizeEdges(MachineFunction &F) {<br>
> - Â assert(Edges.empty() && "Already have an edge list");<br>
> - Â SmallVector<MachineOperand, 4> Cond; // For AnalyzeBranch.<br>
> - Â BlockChain *RequiredChain = 0;<br>
> - Â for (MachineFunction::iterator FI = F.begin(), FE = F.end(); FI != FE; ++FI) {<br>
> - Â Â MachineBasicBlock *From = &*FI;<br>
> - Â Â // We only consider MBBs with analyzable branches. Even if the analysis<br>
> - Â Â // fails, if there is no fallthrough, we can still work with the MBB.<br>
> - Â Â MachineBasicBlock *TBB = 0, *FBB = 0;<br>
> - Â Â Cond.clear();<br>
> - Â Â if (TII->AnalyzeBranch(*From, TBB, FBB, Cond) && From->canFallThrough()) {<br>
> - Â Â Â // We push all unanalyzed blocks onto a chain eagerly to prevent them<br>
> - Â Â Â // from being split later. Create the chain if needed, otherwise just<br>
> - Â Â Â // keep track that these blocks reside on it.<br>
> - Â Â Â if (!RequiredChain)<br>
> - Â Â Â Â RequiredChain = CreateChain(From);<br>
> - Â Â Â else<br>
> - Â Â Â Â BlockToChain[From] = RequiredChain;<br>
> - Â Â } else {<br>
> - Â Â Â // As soon as we find an analyzable branch, add that block to and<br>
> - Â Â Â // finalize any required chain that has been started. The required chain<br>
> - Â Â Â // is only modeling potentially inexplicable fallthrough, so the first<br>
> - Â Â Â // block to have analyzable fallthrough is a known-safe stopping point.<br>
> - Â Â Â if (RequiredChain) {<br>
> - Â Â Â Â BlockToChain[From] = RequiredChain;<br>
> - Â Â Â Â RequiredChain->LastBB = FI;<br>
> - Â Â Â Â RequiredChain = 0;<br>
> - Â Â Â }<br>
> - Â Â }<br>
> -<br>
> - Â Â BlockFrequency BaseFrequency = MBFI->getBlockFreq(From);<br>
> - Â Â for (MachineBasicBlock::succ_iterator SI = From->succ_begin(),<br>
> - Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â SE = From->succ_end();<br>
> - Â Â Â Â SI != SE; ++SI) {<br>
> - Â Â Â MachineBasicBlock *To = *SI;<br>
> - Â Â Â WeightedEdge WE = { BaseFrequency * MBPI->getEdgeProbability(From, To),<br>
> - Â Â Â Â Â Â Â Â Â Â Â Â Â From, To };<br>
> - Â Â Â Edges.push_back(WE);<br>
> - Â Â }<br>
> - Â }<br>
> - Â assert(!RequiredChain && "Never found a terminator for a required chain");<br>
> - Â std::stable_sort(Edges.begin(), Edges.end());<br>
> -}<br>
> +/// This routine walks the predecessors of the current block, looking for<br>
> +/// viable merge candidates. It has strict rules it uses to determine when<br>
> +/// a predecessor can be merged with the current block, which center around<br>
> +/// preserving the CFG structure. It performs the merge if any viable candidate<br>
> +/// is found.<br>
> +void MachineBlockPlacement::mergeSuccessor(MachineBasicBlock *BB,<br>
> + Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â BlockChain *Chain,<br>
> + Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â BlockFilterSet *Filter) {<br>
> + Â assert(BB);<br>
> + Â assert(Chain);<br>
> +<br>
> + Â // If this block is not at the end of its chain, it cannot merge with any<br>
> + Â // other chain.<br>
> + Â if (Chain && *llvm::prior(Chain->end()) != BB)<br>
> + Â Â return;<br>
><br>
> -/// \brief Build chains of basic blocks along hot paths.<br>
> -///<br>
> -/// Build chains by trying to merge each pair of blocks from the mostly costly<br>
> -/// edge first. This is essentially "Algo2" from the Profile Guided Code<br>
> -/// Placement paper. While each node is considered a chain of one block, this<br>
> -/// routine lazily build the chain objects themselves so that when possible it<br>
> -/// can just merge a block into an existing chain.<br>
> -void MachineBlockPlacement::BuildBlockChains() {<br>
> - Â for (SmallVectorImpl<WeightedEdge>::reverse_iterator EI = Edges.rbegin(),<br>
> - Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â EE = Edges.rend();<br>
> - Â Â Â EI != EE; ++EI) {<br>
> - Â Â MachineBasicBlock *SourceB = EI->From, *DestB = EI->To;<br>
> - Â Â if (SourceB == DestB) continue;<br>
> -<br>
> - Â Â BlockChain *SourceChain = BlockToChain.lookup(SourceB);<br>
> - Â Â if (!SourceChain) SourceChain = CreateChain(SourceB);<br>
> - Â Â BlockChain *DestChain = BlockToChain.lookup(DestB);<br>
> - Â Â if (!DestChain) DestChain = CreateChain(DestB);<br>
> - Â Â if (SourceChain == DestChain)<br>
> + Â // Walk through the successors looking for the highest probability edge.<br>
> + Â // FIXME: This is an annoying way to do the comparison, but it's correct.<br>
> + Â // Support should be added to BranchProbability to properly compare two.<br>
> + Â MachineBasicBlock *Successor = 0;<br>
> + Â BlockFrequency BestFreq;<br>
> + Â DEBUG(dbgs() << "Attempting merge from: " << getBlockName(BB) << "\n");<br>
> + Â for (MachineBasicBlock::succ_iterator SI = BB->succ_begin(),<br>
> + Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â SE = BB->succ_end();<br>
> + Â Â Â SI != SE; ++SI) {<br>
> + Â Â if (BB == *SI || (Filter && !Filter->count(*SI)))<br>
> Â Â Â Â continue;<br>
><br>
> - Â Â bool IsSourceTail =<br>
> - Â Â Â SourceChain->LastBB == MachineFunction::iterator(SourceB);<br>
> - Â Â bool IsDestHead =<br>
> - Â Â Â DestChain->FirstBB == MachineFunction::iterator(DestB);<br>
> + Â Â BlockFrequency SuccFreq(BlockFrequency::getEntryFrequency());<br>
> + Â Â SuccFreq *= MBPI->getEdgeProbability(BB, *SI);<br>
> + Â Â DEBUG(dbgs() << " Â Â " << getBlockName(*SI) << " -> " << SuccFreq << "\n");<br>
> + Â Â if (!Successor || SuccFreq > BestFreq || (!(SuccFreq < BestFreq) &&<br>
> + Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â BB->isLayoutSuccessor(*SI))) {<br>
> + Â Â Â Successor = *SI;<br>
> + Â Â Â BestFreq = SuccFreq;<br>
> + Â Â }<br>
> + Â }<br>
> + Â if (!Successor)<br>
> + Â Â return;<br>
><br>
> - Â Â if (!IsSourceTail || !IsDestHead)<br>
> - Â Â Â continue;<br>
> + Â // Grab a chain if it exists already for this successor and make sure the<br>
> + Â // successor is at the start of the chain as we can't merge mid-chain. Also,<br>
> + Â // if the successor chain is the same as our chain, we're already merged.<br>
> + Â BlockChain *SuccChain = BlockToChain[Successor];<br>
> + Â if (SuccChain && (SuccChain == Chain || Successor != *SuccChain->begin()))<br>
> + Â Â return;<br>
><br>
> - Â Â SourceChain->merge(DestChain);<br>
> - Â Â assert(ActiveChains.erase(DestChain));<br>
> + Â // We only merge chains across a CFG merge when the desired merge path is<br>
> + Â // significantly hotter than the incoming edge. We define a hot edge more<br>
> + Â // strictly than the BranchProbabilityInfo does, as the two predecessor<br>
> + Â // blocks may have dramatically different incoming probabilities we need to<br>
> + Â // account for. Therefor we use the "global" edge weight which is the<br>
> + Â // branch's probability times the block frequency of the predecessor.<br>
> + Â BlockFrequency MergeWeight = MBFI->getBlockFreq(BB);<br>
> + Â MergeWeight *= MBPI->getEdgeProbability(BB, Successor);<br>
> + Â // We only want to consider breaking the CFG when the merge weight is much<br>
> + Â // higher (80% vs. 20%), so multiply it by 1/4. This will require the merged<br>
> + Â // edge to be 4x more likely before we disrupt the CFG. This number matches<br>
> + Â // the definition of "hot" in BranchProbabilityAnalysis (80% vs. 20%).<br>
> + Â MergeWeight *= BranchProbability(1, 4);<br>
> + Â for (MachineBasicBlock::pred_iterator PI = Successor->pred_begin(),<br>
> + Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â PE = Successor->pred_end();<br>
> + Â Â Â PI != PE; ++PI) {<br>
> + Â Â if (BB == *PI || Successor == *PI) continue;<br>
> + Â Â BlockFrequency PredWeight = MBFI->getBlockFreq(*PI);<br>
> + Â Â PredWeight *= MBPI->getEdgeProbability(*PI, Successor);<br>
> +<br>
> + Â Â // Return on the first predecessor we find which outstrips our merge weight.<br>
> + Â Â if (MergeWeight < PredWeight)<br>
> + Â Â Â return;<br>
> + Â Â DEBUG(dbgs() << "Breaking CFG edge!\n"<br>
> + Â Â Â Â Â Â Â Â << " Â Edge from " << getBlockNum(BB) << " to "<br>
> + Â Â Â Â Â Â Â Â << getBlockNum(Successor) << ": " << MergeWeight << "\n"<br>
> + Â Â Â Â Â Â Â Â << " Â Â Â Â vs. " << getBlockNum(BB) << " to "<br>
> + Â Â Â Â Â Â Â Â << getBlockNum(*PI) << ": " << PredWeight << "\n");<br>
> + Â }<br>
> +<br>
> + Â DEBUG(dbgs() << "Merging from " << getBlockNum(BB) << " to "<br>
> + Â Â Â Â Â Â Â << getBlockNum(Successor) << "\n");<br>
> + Â Chain->merge(Successor, SuccChain);<br>
> +}<br>
> +<br>
> +/// \brief Forms basic block chains from the natural loop structures.<br>
> +///<br>
> +/// These chains are designed to preserve the existing *structure* of the code<br>
> +/// as much as possible. We can then stitch the chains together in a way which<br>
> +/// both preserves the topological structure and minimizes taken conditional<br>
> +/// branches.<br>
> +void MachineBlockPlacement::buildLoopChains(MachineFunction &F, MachineLoop &L) {<br>
> + Â // First recurse through any nested loops, building chains for those inner<br>
> + Â // loops.<br>
> + Â for (MachineLoop::iterator LI = L.begin(), LE = L.end(); LI != LE; ++LI)<br>
> + Â Â buildLoopChains(F, **LI);<br>
> +<br>
> + Â SmallPtrSet<MachineBasicBlock *, 16> LoopBlockSet(L.block_begin(),<br>
> + Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â L.block_end());<br>
> +<br>
> + Â // Begin building up a set of chains of blocks within this loop which should<br>
> + Â // remain contiguous. Some of the blocks already belong to a chain which<br>
> + Â // represents an inner loop.<br>
> + Â for (MachineLoop::block_iterator BI = L.block_begin(), BE = L.block_end();<br>
> + Â Â Â BI != BE; ++BI) {<br>
> + Â Â MachineBasicBlock *BB = *BI;<br>
> + Â Â BlockChain *Chain = BlockToChain[BB];<br>
> + Â Â if (!Chain) Chain = CreateChain(BB);<br>
> + Â Â mergeSuccessor(BB, Chain, &LoopBlockSet);<br>
> + Â }<br>
> +}<br>
> +<br>
> +void MachineBlockPlacement::buildCFGChains(MachineFunction &F) {<br>
> + Â // First build any loop-based chains.<br>
> + Â for (MachineLoopInfo::iterator LI = MLI->begin(), LE = MLI->end(); LI != LE;<br>
> + Â Â Â ++LI)<br>
> + Â Â buildLoopChains(F, **LI);<br>
> +<br>
> + Â // Now walk the blocks of the function forming chains where they don't<br>
> + Â // violate any CFG structure.<br>
> + Â for (MachineFunction::iterator BI = F.begin(), BE = F.end();<br>
> + Â Â Â BI != BE; ++BI) {<br>
> + Â Â MachineBasicBlock *BB = BI;<br>
> + Â Â BlockChain *Chain = BlockToChain[BB];<br>
> + Â Â if (!Chain) Chain = CreateChain(BB);<br>
> + Â Â mergeSuccessor(BB, Chain);<br>
> Â Â }<br>
> Â }<br>
><br>
> -/// \brief Prioritize the chains to minimize back-edges between chains.<br>
> -///<br>
> -/// This is the trickiest part of the placement algorithm. Each chain is<br>
> -/// a hot-path through a sequence of basic blocks, but there are conditional<br>
> -/// branches away from this hot path, and to some other chain. Hardware branch<br>
> -/// predictors favor back edges over forward edges, and so it is desirable to<br>
> -/// arrange the targets of branches away from a hot path and to some other<br>
> -/// chain to come later in the function, making them forward branches, and<br>
> -/// helping the branch predictor to predict fallthrough.<br>
> -///<br>
> -/// In some cases, this is easy. simply topologically walking from the entry<br>
> -/// chain through its successors in order would work if there were no cycles<br>
> -/// between the chains of blocks, but often there are. In such a case, we first<br>
> -/// need to identify the participants in the cycle, and then rank them so that<br>
> -/// the linearizing of the chains has the lowest *probability* of causing<br>
> -/// a mispredicted branch. To compute the correct rank for a chain, we take the<br>
> -/// complement of the branch probability for each branch leading away from the<br>
> -/// chain and multiply it by the frequency of the source block for that branch.<br>
> -/// This gives us the probability of that particular branch *not* being taken<br>
> -/// in this function. The sum of these probabilities for each chain is used as<br>
> -/// a rank, so that we order the chain with the highest such sum first.<br>
> -/// FIXME: This seems like a good approximation, but there is probably a known<br>
> -/// technique for ordering of an SCC given edge weights. It would be good to<br>
> -/// use that, or even use its code if possible.<br>
> -///<br>
> -/// Also notable is that we prioritize the chains from the bottom up, and so<br>
> -/// all of the "first" and "before" relationships end up inverted in the code.<br>
> -void MachineBlockPlacement::PrioritizeChains(MachineFunction &F) {<br>
> +void MachineBlockPlacement::placeChainsTopologically(MachineFunction &F) {<br>
> Â Â MachineBasicBlock *EntryB = &F.front();<br>
> Â Â BlockChain *EntryChain = BlockToChain[EntryB];<br>
> Â Â assert(EntryChain && "Missing chain for entry block");<br>
> - Â assert(EntryChain->FirstBB == F.begin() &&<br>
> + Â assert(*EntryChain->begin() == EntryB &&<br>
> Â Â Â Â Â "Entry block is not the head of the entry block chain");<br>
><br>
> - Â // Form an SCC and walk it from the bottom up.<br>
> - Â SmallPtrSet<BlockChain *, 4> IsInSCC;<br>
> - Â for (scc_iterator<BlockChain *> I = scc_begin(EntryChain);<br>
> - Â Â Â !I.isAtEnd(); ++I) {<br>
> - Â Â const std::vector<BlockChain *> &SCC = *I;<br>
> - Â Â PChains.insert(PChains.end(), SCC.begin(), SCC.end());<br>
> -<br>
> - Â Â // If there is only one chain in the SCC, it's trivially sorted so just<br>
> - Â Â // bail out early. Sorting the SCC is expensive.<br>
> - Â Â if (SCC.size() == 1)<br>
> + Â // Walk the blocks in RPO, and insert each block for a chain in order the<br>
> + Â // first time we see that chain.<br>
> + Â MachineFunction::iterator InsertPos = F.begin();<br>
> + Â SmallPtrSet<BlockChain *, 16> VisitedChains;<br>
> + Â ReversePostOrderTraversal<MachineBasicBlock *> RPOT(EntryB);<br>
> + Â typedef ReversePostOrderTraversal<MachineBasicBlock *>::rpo_iterator<br>
> + Â Â rpo_iterator;<br>
> + Â for (rpo_iterator I = RPOT.begin(), E = RPOT.end(); I != E; ++I) {<br>
> + Â Â BlockChain *Chain = BlockToChain[*I];<br>
> + Â Â assert(Chain);<br>
> + Â Â if(!VisitedChains.insert(Chain))<br>
> Â Â Â Â continue;<br>
> -<br>
> - Â Â // We work strictly on the PChains range from here on out to maximize<br>
> - Â Â // locality.<br>
> - Â Â SmallVectorImpl<BlockChain *>::iterator SCCEnd = PChains.end(),<br>
> - Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â SCCBegin = SCCEnd - SCC.size();<br>
> - Â Â IsInSCC.clear();<br>
> - Â Â IsInSCC.insert(SCCBegin, SCCEnd);<br>
> -<br>
> - Â Â // Compute the edge frequency of staying in a chain, despite the existency<br>
> - Â Â // of an edge to some other chain within this SCC.<br>
> - Â Â for (SmallVectorImpl<BlockChain *>::iterator SCCI = SCCBegin;<br>
> - Â Â Â Â SCCI != SCCEnd; ++SCCI) {<br>
> - Â Â Â BlockChain *Chain = *SCCI;<br>
> -<br>
> - Â Â Â // Special case the entry chain. Regardless of the weights of other<br>
> - Â Â Â // chains, the entry chain *must* come first, so move it to the end, and<br>
> - Â Â Â // avoid processing that chain at all.<br>
> - Â Â Â if (Chain == EntryChain) {<br>
> - Â Â Â Â --SCCEnd;<br>
> - Â Â Â Â if (SCCI == SCCEnd) break;<br>
> - Â Â Â Â Chain = *SCCI = *SCCEnd;<br>
> - Â Â Â Â *SCCEnd = EntryChain;<br>
> - Â Â Â }<br>
> -<br>
> - Â Â Â // Walk over every block in this chain looking for out-bound edges to<br>
> - Â Â Â // other chains in this SCC.<br>
> - Â Â Â for (MachineFunction::iterator BI = Chain->FirstBB,<br>
> - Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â BE = llvm::next(Chain->LastBB);<br>
> - Â Â Â Â Â BI != BE; ++BI) {<br>
> - Â Â Â Â MachineBasicBlock *From = &*BI;<br>
> - Â Â Â Â for (MachineBasicBlock::succ_iterator SI = BI->succ_begin(),<br>
> - Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â SE = BI->succ_end();<br>
> - Â Â Â Â Â Â SI != SE; ++SI) {<br>
> - Â Â Â Â Â MachineBasicBlock *To = *SI;<br>
> - Â Â Â Â Â if (!To || !IsInSCC.count(BlockToChain[To]))<br>
> - Â Â Â Â Â Â continue;<br>
> - Â Â Â Â Â BranchProbability ComplEdgeProb =<br>
> - Â Â Â Â Â Â MBPI->getEdgeProbability(From, To).getCompl();<br>
> - Â Â Â Â Â Chain->InChainEdgeFrequency +=<br>
> - Â Â Â Â Â Â MBFI->getBlockFreq(From) * ComplEdgeProb;<br>
> - Â Â Â Â }<br>
> - Â Â Â }<br>
> + Â Â for (BlockChain::iterator BI = Chain->begin(), BE = Chain->end(); BI != BE;<br>
> + Â Â Â Â ++BI) {<br>
> + Â Â Â DEBUG(dbgs() << (BI == Chain->begin() ? "Placing chain "<br>
> + Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â : " Â Â Â Â Â ... ")<br>
> + Â Â Â Â Â Â Â Â Â << getBlockName(*BI) << "\n");<br>
> + Â Â Â if (InsertPos != MachineFunction::iterator(*BI))<br>
> + Â Â Â Â F.splice(InsertPos, *BI);<br>
> + Â Â Â else<br>
> + Â Â Â Â ++InsertPos;<br>
> Â Â Â }<br>
> -<br>
> - Â Â // Sort the chains within the SCC according to their edge frequencies,<br>
> - Â Â // which should make the least costly chain of blocks to mis-place be<br>
> - Â Â // ordered first in the prioritized sequence.<br>
> - Â Â std::stable_sort(SCCBegin, SCCEnd, ChainPtrPrioritySorter());<br>
> Â Â }<br>
> -}<br>
> -<br>
> -/// \brief Splice the function blocks together based on the chain priorities.<br>
> -///<br>
> -/// Each chain is already represented as a contiguous range of blocks in the<br>
> -/// function. Simply walk backwards down the prioritized chains and splice in<br>
> -/// any chains out of order. Note that the first chain we visit is necessarily<br>
> -/// the entry chain. It has no predecessors and so must be the top of the SCC.<br>
> -/// Also, we cannot splice any chain prior to the entry chain as we can't<br>
> -/// splice any blocks prior to the entry block.<br>
> -void MachineBlockPlacement::PlaceBlockChains(MachineFunction &F) {<br>
> - Â assert(!PChains.empty() && "No chains were prioritized");<br>
> - Â assert(PChains.back() == BlockToChain[&F.front()] &&<br>
> - Â Â Â Â "The entry chain must always be the final chain");<br>
> -<br>
> - Â MachineFunction::iterator InsertPos = F.begin();<br>
> - Â for (SmallVectorImpl<BlockChain *>::reverse_iterator CI = PChains.rbegin(),<br>
> - Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â CE = PChains.rend();<br>
> - Â Â Â CI != CE; ++CI) {<br>
> - Â Â BlockChain *Chain = *CI;<br>
> - Â Â // Check that we process this chain only once for debugging.<br>
> - Â Â assert(ActiveChains.erase(Chain) && "Processed a chain twice");<br>
> -<br>
> - Â Â // If this chain is already in the right position, just skip past it.<br>
> - Â Â // Otherwise, splice it into position.<br>
> - Â Â if (InsertPos == Chain->FirstBB)<br>
> - Â Â Â InsertPos = llvm::next(Chain->LastBB);<br>
> - Â Â else<br>
> - Â Â Â F.splice(InsertPos, Chain->FirstBB, llvm::next(Chain->LastBB));<br>
> - Â }<br>
> -<br>
> - Â // Note that we can't assert this is empty as there may be unreachable blocks<br>
> - Â // in the function.<br>
> -#ifndef NDEBUG<br>
> - Â ActiveChains.clear();<br>
> -#endif<br>
><br>
> Â Â // Now that every block is in its final position, update all of the<br>
> Â Â // terminators.<br>
> @@ -638,21 +474,13 @@<br>
> Â Â MLI = &getAnalysis<MachineLoopInfo>();<br>
> Â Â TII = F.getTarget().getInstrInfo();<br>
> Â Â TLI = F.getTarget().getTargetLowering();<br>
> - Â assert(Edges.empty());<br>
> Â Â assert(BlockToChain.empty());<br>
> - Â assert(PChains.empty());<br>
> - Â assert(ActiveChains.empty());<br>
><br>
> - Â PrioritizeEdges(F);<br>
> - Â BuildBlockChains();<br>
> - Â PrioritizeChains(F);<br>
> - Â PlaceBlockChains(F);<br>
> + Â buildCFGChains(F);<br>
> + Â placeChainsTopologically(F);<br>
> Â Â AlignLoops(F);<br>
><br>
> - Â Edges.clear();<br>
> Â Â BlockToChain.clear();<br>
> - Â PChains.clear();<br>
> - Â ChainAllocator.DestroyAll();<br>
><br>
> Â Â // We always return true as we have no way to track whether the final order<br>
> Â Â // differs from the original order.<br>
><br>
> Modified: llvm/trunk/test/CodeGen/X86/block-placement.ll<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/block-placement.ll?rev=142743&r1=142742&r2=142743&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/block-placement.ll?rev=142743&r1=142742&r2=142743&view=diff</a><br>
> ==============================================================================<br>
> --- llvm/trunk/test/CodeGen/X86/block-placement.ll (original)<br>
> +++ llvm/trunk/test/CodeGen/X86/block-placement.ll Sun Oct 23 04:18:45 2011<br>
> @@ -105,11 +105,10 @@<br>
> Â ; CHECK: test_nested_loop_align:<br>
> Â ; CHECK: %entry<br>
> Â ; CHECK: .align [[ALIGN]],<br>
> -; CHECK-NEXT: %loop.body.1<br>
> +; CHECK-NEXT: %loop.body.2<br>
> Â ; CHECK: .align [[ALIGN]],<br>
> Â ; CHECK-NEXT: %inner.loop.body<br>
> Â ; CHECK-NOT: .align<br>
> -; CHECK: %loop.body.2<br>
> Â ; CHECK: %exit<br>
><br>
> Â entry:<br>
><br>
><br>
> _______________________________________________<br>
> llvm-commits mailing list<br>
> <a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br>
> <a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>
</div></div></blockquote></div><br>