[all-commits] [llvm/llvm-project] 7c0387: LIS: fix handleMove to properly extend main range

Stanislav Mekhanoshin via All-commits all-commits at lists.llvm.org
Tue Jul 7 11:52:54 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 7c038726453b76d6f40590b22304c43ffa05aaf1
      https://github.com/llvm/llvm-project/commit/7c038726453b76d6f40590b22304c43ffa05aaf1
  Author: Stanislav Mekhanoshin <Stanislav.Mekhanoshin at amd.com>
  Date:   2020-07-07 (Tue, 07 Jul 2020)

  Changed paths:
    M llvm/lib/CodeGen/LiveIntervals.cpp
    M llvm/unittests/MI/LiveIntervalTest.cpp

  Log Message:
  -----------
  LIS: fix handleMove to properly extend main range

handleMoveDown or handleMoveUp cannot properly repair a main
range of a LiveInterval since they only get LiveRange. There
is a problem if certain use has moved few segments away and
there is a hole in the main range in between of these two
locations. We may get a SubRange with a very extended Segment
spanning several Segments of the main range and also spanning
that hole. If that happens then we end up with the main range
not covering its SubRange which is an error.

It might be possible to attempt fixing the main range in place
just between of the old and new index by extending all of its
Segments in between, but it is unclear this logic will be
faster than just straight constructMainRangeFromSubranges,
which itself is pretty cheap since it only contains interval
logic. That will also require shrinkToUses() call after which
is probably even more expensive.

In the test second move is from 64B to 92B for the sub1.
Subrange is correctly fixed:

L000000000000000C [16r,32B:0)[32B,92r:1)  0 at 16r 1 at 32B-phi

But the main range has a hole in between 80d and 88r after
updateRange():

%1 [16r,32B:0)[32B,80r:4)[80r,80d:3)[88r,96r:1)[96r,160B:2)

Since source position is 64B this segment is not even considered
by the updateRange().

Differential Revision: https://reviews.llvm.org/D82916




More information about the All-commits mailing list