This is an archive of the discontinued LLVM Phabricator instance.

[X86] Fix liveness information when expanding X86::EH_SjLj_LongJmp64
ClosedPublic

Authored by thegameg on Aug 3 2018, 9:05 AM.

Details

Summary

test/CodeGen/X86/shadow-stack.ll has the following machine verifier errors:

*** Bad machine code: Using a killed virtual register ***
- function:    bar
- basic block: %bb.6 entry (0x7fdc81857818)
- instruction: %3:gr64 = MOV64rm killed %2:gr64, 1, $noreg, 8, $noreg
- operand 1:   killed %2:gr64

*** Bad machine code: Using a killed virtual register ***
- function:    bar
- basic block: %bb.6 entry (0x7fdc81857818)
- instruction: $rsp = MOV64rm killed %2:gr64, 1, $noreg, 16, $noreg
- operand 1:   killed %2:gr64

*** Bad machine code: Virtual register killed in block, but needed live out. ***
- function:    bar
- basic block: %bb.2 entry (0x7fdc818574f8)
Virtual register %2 is used after the block.

The fix here is to only copy the machine operand's register without the
kill flags for all the instructions except the very last one of the
sequence.

I had to insert dummy PHIs in the test case to force the NoPHI function
property to be set to false. More on this here: https://llvm.org/PR38439

Diff Detail

Repository
rL LLVM

Event Timeline

thegameg created this revision.Aug 3 2018, 9:05 AM
aivchenk accepted this revision.Aug 17 2018, 6:11 AM

Thanks for the fix. LGTM

This revision is now accepted and ready to land.Aug 17 2018, 6:11 AM
This revision was automatically updated to reflect the committed changes.