This is an archive of the discontinued LLVM Phabricator instance.

[WIP][DebugInfo][MachineSink] Preserve DBG_VALUE subregisters when sinking
Needs ReviewPublic

Authored by jmorse on Dec 10 2019, 9:05 AM.

Details

Reviewers
uabelho
Summary

When sinking DBG_VALUEs, we were creating the new sunk DBG_VALUE by copying the old one. Unfortunately, it turns out that in the meantime copy propagation can significantly alter the old one, for example by changing the subregister it refers to.

Avoid any risk of sunk DBG_VALUEs picking up later subregister information, by storing the original (TM) subregister in the sink record.

This is WIP because the added test case _used_ to be failing, but now isn't for some reason. I'd like to share it with @uabelho who's reporting this problem happening downstream, to see whether I'm barking up the right tree before analysing further.

Diff Detail

Event Timeline

jmorse created this revision.Dec 10 2019, 9:05 AM
Herald added a project: Restricted Project. · View Herald TranscriptDec 10 2019, 9:05 AM

I think you're on the right track. My mir-reproducer passes with this patch, so now I get the wanted

%6:an32_rn_pairs = COPY %5.hiAcc
%8:an32_0_7 = COPY %6
DBG_VALUE %8, [...]

instead of the previous

%6:an32_rn_pairs = COPY %5.hiAcc
%8:an32_0_7 = COPY %6
DBG_VALUE %8.hiAcc:an32_0_7, [...]