This is an archive of the discontinued LLVM Phabricator instance.

VirtRegMap.cpp should not just remove an identity copy which also has a impl-def of a super-reg
Needs ReviewPublic

Authored by jonpa on Apr 21 2016, 9:19 AM.

Details

Reviewers
qcolombet
Summary

VirtRegMap removes identity copies, but that leads to machine-verifier complaints if there is a def of a super reg as well.

I am not sure what the best fix is, but the patch attached seems to fix this by transforming the COPY to an IMPLICIT_DEF when there is a def of a super-reg. The patch assumes (arbitrarily) that there could only be one extra operand - not sure if this is always true...

I put this with a testcase on Bugzilla a while ago and would appreciate any review.
https://llvm.org/bugs/show_bug.cgi?id=27156

Diff Detail

Event Timeline

jonpa updated this revision to Diff 54517.Apr 21 2016, 9:19 AM
jonpa retitled this revision from to VirtRegMap.cpp should not just remove an identity copy which also has a impl-def of a super-reg.
jonpa updated this object.
jonpa added a reviewer: qcolombet.
jonpa added a subscriber: llvm-commits.
qcolombet edited edge metadata.Apr 21 2016, 9:47 AM
qcolombet added a subscriber: qcolombet.

We could fix MachineInstr:: isIdentityCopy instead. Indeed, the next optimization that removes them will hit the same issue. Moreover, I do not think we are supposed to have implicit_def around after TwoAddrPass (not entirely sure about that though).

Q.

Also, side question, how do we end up with this representation?
Do we use an undef lane or something, that’s why the verifier complains?