[PATCH] D21189: Create subranges for new intervals resulting from live interval splitting

Matthias Braun via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 22 13:01:26 PDT 2016


MatzeB added a comment.

In http://reviews.llvm.org/D21189#464458, @kparzysz wrote:

> In http://reviews.llvm.org/D21189#463791, @MatzeB wrote:
>
> > I haven't looked at the actual patch yet, but this last paragraph sounds wrong to me. A <def,read-undef> does indeed not read the super register, this is exactly why we add the read-undef flag!
>
>
> Consider this case:
>
>   100 vreg1:sub0<def,read-undef> = ...
>   108 ...
>   116 vreg1:sub1<def,read-undef> = ...
>   124 ...
>   132 ... = vreg1<kill>
>
>
> The live range for sub0 will be [100,132), the live range for sub1 will be [116,132).  Now, when the live range for the main register is constructed, we first see the def at 100 and create a dead def: [100,100d).  Then a def at 116 is seen, and we add [116,116d) for it, finally there is a use at 132, so we extend the range [100r,100d)[116r,116d) to 132.  The problem is that the def at 116 does not read vreg1, so the def at 100 will not be extended to 132.


In this situation the sub0 def at 100 does NOT live until the 132. That would only be the case if the 116 def does not have the read-undef flag set.

The motivation for this behavior is the situation when subregisters are not tracked individually. In this scheme subregister defs look like a read+write. And a typical problematic situation would be this:

  100 %vreg0:sub0 = ...
  110 %vreg0:sub1 = ...
  120     use %vreg0
   ... (no use of vreg0 here)
  800 %vreg0:sub0 = ...
  810 %vreg0:sub1 = ...
  820.   use %vreg0

In this example you do not want vreg0 to be alive between 120 and 800. So you have to make sure the def at 800 does not look like a use, so we add the read-undef flag. (see also the comment in MachineOperand::readsReg()/IsUndef).


Repository:
  rL LLVM

http://reviews.llvm.org/D21189





More information about the llvm-commits mailing list