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

Krzysztof Parzyszek via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 1 08:51:07 PDT 2016


kparzysz updated this revision to Diff 62498.
kparzysz added a comment.

Updated the patch to reflect the "undefining" interpretation of <def,read-undef>.  The code related to subrange creation in live range splitting remains unchanged.  The differences are in how live ranges (specifically subranges) are extended.

The main problem to overcome was that a LiveRange that is a subrange of a LiveInterval did not contain any information about locations of <def,read-undef> for non-overlapping subranges, even though they do affect liveness of the subrange.  Specifically, <def,read-undef> of sub0 does undefine sub1 (assuming sub0 and sub1 do not overlap), but the LiveRange of sub1 would not contain any information about that.  This lead to difficulties in extending the LiveRange of sub1, since by analyzing that LiveRange alone, it could be extended across a <def,read-undef> for sub0, causing inconsistency between the code (i.e. operand flags) and the calculated live ranges.

The solution is to add a list of such explicit "undefinition points" to each subrange.  A <def,read-undef> of sub0 at Idx would cause Idx to be added to "undefs" list for all non-overlapping subranges.  Later on, when extending the live range for sub1, these "undefs" will prevent any def in that range from reaching any use across such an "undefinition point".  The "undef" information is only used for extending live ranges and does not interfere with any other analyses, including checking live ranges for overlapping.  Code that manipulated live intervals directly needs to be amended to update the "undef" information in the live ranges, since such manipulation can render the "undef" information invalid.  A member function in LiveInterval was introduced to recalculate the "undef" data.

This patch passes our internal correctness tests (on Hexagon, with subregister liveness tracking enabled).  Please consider it a proof-of-concept (which may be close to the final version)---I plan to review the LLVM code to see if any other places need updating to reflect the changes before committing.


Repository:
  rL LLVM

http://reviews.llvm.org/D21189

Files:
  include/llvm/CodeGen/LiveInterval.h
  include/llvm/CodeGen/LiveIntervalAnalysis.h
  lib/CodeGen/LiveInterval.cpp
  lib/CodeGen/LiveIntervalAnalysis.cpp
  lib/CodeGen/LiveRangeCalc.cpp
  lib/CodeGen/LiveRangeCalc.h
  lib/CodeGen/LiveRangeEdit.cpp
  lib/CodeGen/MachineVerifier.cpp
  lib/CodeGen/RegisterCoalescer.cpp
  lib/CodeGen/RenameIndependentSubregs.cpp
  lib/CodeGen/SplitKit.cpp
  lib/CodeGen/SplitKit.h
  lib/CodeGen/VirtRegMap.cpp
  lib/Target/Hexagon/HexagonExpandCondsets.cpp
  test/CodeGen/Hexagon/regalloc-bad-undef.mir

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D21189.62498.patch
Type: text/x-patch
Size: 74992 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160701/048d0423/attachment.bin>


More information about the llvm-commits mailing list