[LLVMdev] reg_iterator Caveats

David Greene dag at cray.com
Sun Mar 30 11:17:53 PDT 2008

I'm forwarding this to llvmdev so it doesn't get lost in the sea of commits...


----------  Forwarded Message  ----------

Subject: Re: [llvm-commits] [llvm] r48521 - in /llvm/trunk: 
include/llvm/CodeGen/LiveVariables.h lib/CodeGen/LiveVariables.cpp 
Date: Friday 28 March 2008 16:34
From: David Greene <dag at cray.com>
To: llvm-commits at cs.uiuc.edu
Cc: Chris Lattner <clattner at apple.com>

On Tuesday 18 March 2008 23:59, Chris Lattner wrote:
> How about using reg_iterators to do this?  I assume this only applies
> to vregs.  If you walk the use_iterator list for the register, you can
> very efficiently discard uses in other blocks (check User->getparent()
> == MBB).  Any uses within the same block are either a) in phi nodes,
> in which case they are above the instruction or b) users later in the
> block.
> If the representation is not in SSA form, you have to do some more
> checks, but this should be a lot faster than scanning the whole
> machine block.  MBB's can be very large after all :)

Ack.  I just started looking at using reg_iterators elsewhere but wasn't
aware of this non-SSA caveat.  Can you elaborate?



More information about the llvm-dev mailing list