This is an archive of the discontinued LLVM Phabricator instance.

[SystemZ] Build TM from scratch in convertToLoadAndTest, to get CC operand in right place.
ClosedPublic

Authored by jonpa on Jun 6 2018, 4:25 AM.

Details

Reviewers
uweigand
Summary

This is needed since the SchedModel defines a list of write latencies, which is to be used by mapping to the MI operand order. Therefore the CC must not end up last in the list in the cases where RegAlloc adds an extra implicit-def operand.

In order to build a new MI, the iteration method in optimizeCompareZero() had to be fixed so that the iterator does not get invalidated as the old MI is erased.

RegAlloc adds such operands for the SuperReg it seems, when SubRegIdx != 0. The other potentially relevant cases where setDesc is called and then the CC register is added would be in SystemZShortenInst::shortenOn001AddCC. Those instructions do however not seem to use subregs to begin with, so it seems they do not need to worry about regalloc operands.

At least the SPEC looks good with just the LT handling per this patch.

Diff Detail

Event Timeline

jonpa created this revision.Jun 6 2018, 4:25 AM
uweigand accepted this revision.Jun 6 2018, 4:41 AM

Otherwise, this LGTM.

lib/Target/SystemZ/SystemZElimCompare.cpp
437

Shouldn't this be rend instead of instr_rend, since this is a reverse_iterator, not a reverse_instr_iterator?

This revision is now accepted and ready to land.Jun 6 2018, 4:41 AM
jonpa closed this revision.Jun 6 2018, 11:05 PM

Shouldn't this be rend instead of instr_rend, since this is a reverse_iterator, not a reverse_instr_iterator?

Ah, yes. Thanks.

r334161