This is an archive of the discontinued LLVM Phabricator instance.

Properly handle live subranges when moving instructions
AbandonedPublic

Authored by kparzysz on Aug 25 2016, 9:23 AM.

Details

Summary

Subregister ranges need to be updated even when the instruction being moved does not explicitly use/define the particular subregister (due to the fact that a def of a subregister is treated as a use of all the other lanes for the purposes of liveness tracking). Make sure that the update is done correctly.

https://llvm.org/bugs/show_bug.cgi?id=29164

Diff Detail

Repository
rL LLVM

Event Timeline

kparzysz updated this revision to Diff 69258.Aug 25 2016, 9:23 AM
kparzysz retitled this revision from to Fix updating subranges in LiveIntervals::HMEditor::updateAllRanges.
kparzysz updated this object.
kparzysz added a reviewer: MatzeB.
kparzysz set the repository for this revision to rL LLVM.
kparzysz added subscribers: llvm-commits, michel.daenzer.
kparzysz updated this revision to Diff 69429.Aug 26 2016, 1:16 PM
kparzysz retitled this revision from Fix updating subranges in LiveIntervals::HMEditor::updateAllRanges to Properly handle live subranges when moving instructions.
kparzysz updated this object.
kparzysz edited edge metadata.

Added more changes to account for subregister liveness.

MatzeB edited edge metadata.Aug 26 2016, 10:47 PM

This should have a test in unittests/MI/LiveIntervalTest.cpp. Hopefully you can remodel the situation from the example that way.

(And just to warn you: I am in vacation for the next two weeks and will only get back to this after that time).

lib/CodeGen/LiveIntervalAnalysis.cpp
1049–1050

Why does the liverange for sub2 end at 1008B in this example? This is about the subregister liverange not about the main liverange is it? Then nothing seems to be reading the value at 1008 so I don't see why the liverange ends there.

kparzysz added inline comments.Aug 29 2016, 6:41 AM
lib/CodeGen/LiveIntervalAnalysis.cpp
1049–1050

The def of sub1 reads sub2.

kparzysz updated this revision to Diff 69569.Aug 29 2016, 7:26 AM
kparzysz edited edge metadata.

Reduced the testcases.

kparzysz updated this object.Aug 29 2016, 7:27 AM
qcolombet edited edge metadata.Sep 1 2016, 3:13 PM

Hi Krzysztof,

I am not seeing a unitest in unittests/MI/LiveIntervalTest.cpp like Matthias suggested.
Also, could you use "opt -instnamer" on the ll test cases.

Other than that, LGTM just one nitpick, see inlined comment.

Cheers,
-Quentin

lib/CodeGen/LiveIntervalAnalysis.cpp
1004

Document the extra parameters.

kparzysz abandoned this revision.Sep 2 2016, 6:59 AM

The problem is somewhere else: live subranges should not be extended to other subregs' defs.

lib/CodeGen/LiveIntervalAnalysis.cpp
1049–1050

Actually, you are right. My comment is incorrect.