[llvm-commits] [llvm] r167758 - /llvm/trunk/lib/CodeGen/RegisterCoalescer.cpp

Jakob Stoklund Olesen stoklund at 2pi.dk
Mon Nov 12 14:25:46 PST 2012


On Nov 12, 2012, at 1:42 PM, Andrew Trick <atrick at apple.com> wrote:

> +// Return true if this block should be vacated by the coalescer to eliminate
> +// branches. The important cases to handle in the coalescer are critical edges
> +// split during phi elimination which contain only copies. Simple blocks that
> +// contain non-branches should also be vacated, but this can be handled by an
> +// earlier pass similar to early if-conversion.

You probably don't want to do this for critical edges entering and exiting loops.

> +static bool isSplitEdge(const MachineBasicBlock *MBB) {
> +  if (MBB->pred_size() != 1 || MBB->succ_size() != 1)
> +    return false;
> +
> +  for (MachineBasicBlock::const_iterator MII = MBB->begin(), E = MBB->end();
> +       MII != E; ++MII) {

E = MBB->getFirstTerminator() ?

> +    if (MII->isCopyLike())
> +      continue;

MII->isTransient() ?

> +    if (MII->isUnconditionalBranch())
> +      continue;
> +    return false;
> +  }
> +  return true;
> +}

/jakob




More information about the llvm-commits mailing list