This is an archive of the discontinued LLVM Phabricator instance.

[MachineOutliner][X86] Use TAILJMPd64 instead of JMP_1 for TailCall construction
ClosedPublic

Authored by thegameg on Jul 13 2018, 8:31 AM.

Details

Summary

The machine verifier asserts with:

Assertion failed: (isMBB() && "Wrong MachineOperand accessor"), function getMBB, file ../include/llvm/CodeGen/MachineOperand.h, line 542.

It calls analyzeBranch which tries to call getMBB if the opcode is JMP_1, but in this case we do:

JMP_1 @OUTLINED_FUNCTION

I believe we have to use TAILJMPd64 instead of JMP_1 since JMP_1 is used with brtarget8.

Diff Detail

Repository
rL LLVM

Event Timeline

thegameg created this revision.Jul 13 2018, 8:31 AM
craig.topper accepted this revision.Jul 13 2018, 8:38 AM

This seems right to me. I assume from the use of CALL64pcrel32 in the other branch that outlining is 64-bit only?

This revision is now accepted and ready to land.Jul 13 2018, 8:38 AM
paquette accepted this revision.Jul 13 2018, 9:00 AM

This looks good to me.

This seems right to me. I assume from the use of CALL64pcrel32 in the other branch that outlining is 64-bit only?

Yep!

Though JMP_1 has a one byte offset and will get relaxed to JMP_4 by the assembler if the offset isn't in the range [128,-127]. TAILJMPd64 always encodes to the same encoding as JMP_4 and doesn't go through relaxation in the assembler.

I don't know enough about outlining. Are we usually/often getting a size savings from the JMP_1?

This revision was automatically updated to reflect the committed changes.