This is an archive of the discontinued LLVM Phabricator instance.

[SelectionDAGBuilder] Make sure DemoteReg ends up in right reg-class in visitRet().
ClosedPublic

Authored by jonpa on Nov 11 2015, 12:20 AM.

Details

Reviewers
hfinkel
Summary

The virtual register containing the address for returned value on
stack should in the DAG be represented with a CopyFromReg node and not
a Register node. Otherwise, InstrEmitter will not make sure that it
ends up in the right register class for the target instruction.

SystemZ needs this, because the reg class for address registers is a
subset of the general 64 bit register class.
test/SystemZ/CodeGen/args-07.ll and args-04.ll updated to run with
-verify-machineinstrs.

Note: InstrEmitter will not check for proper regclass for a Register node, as it
does for a CopyFromReg. It seems that the Register nodes as they are handled
in InstrEmitter are intended for call / return phys reg operands which need to be
flagged as implicit. But since the DemoteReg is a virtual register, it therefore
seems it doesn't really need to be a Register node for any particular reason.

Diff Detail

Event Timeline

jonpa updated this revision to Diff 39885.Nov 11 2015, 12:20 AM
jonpa retitled this revision from to [SelectionDAGBuilder] Make sure DemoteReg ends up in right reg-class in visitRet()..
jonpa updated this object.
jonpa added a subscriber: llvm-commits.
hfinkel accepted this revision.Nov 11 2015, 9:09 AM
hfinkel added a reviewer: hfinkel.
hfinkel added a subscriber: hfinkel.

LGTM.

This revision is now accepted and ready to land.Nov 11 2015, 9:09 AM
jonpa closed this revision.Nov 23 2015, 1:41 AM

commited as r253461.