This is an archive of the discontinued LLVM Phabricator instance.

[X86] Don't copy kill flag when expanding LCMPXCHG16B_SAVE_RBX
ClosedPublic

Authored by craig.topper on Oct 9 2020, 10:45 AM.

Details

Summary

The expansion code creates a copy to RBX before the real LCMPXCHG16B.
It's possible this copy uses a register that is also used by the
real LCMPXCHG16B. If we set the kill flag on the use in the copy,
then we'll fail the machine verifier on the use on the LCMPXCHG16B.

Here's an example of expansion that breaks the verifier

$rbx = MOV64rr killed $rcx
LCMPXCHG16B killed renamable $r8, 1, $noreg, 0, $noreg, implicit-def $rax, implicit-def $rdx, implicit-def $eflags, implicit $rax, implicit $rbx, implicit $rcx, implicit $rdx
$rbx = MOV64rr killed $r9

Diff Detail

Event Timeline

craig.topper created this revision.Oct 9 2020, 10:45 AM
Herald added a project: Restricted Project. · View Herald TranscriptOct 9 2020, 10:45 AM
Herald added subscribers: jfb, hiraditya. · View Herald Transcript
craig.topper requested review of this revision.Oct 9 2020, 10:45 AM
craig.topper edited the summary of this revision. (Show Details)Oct 9 2020, 10:47 AM
qcolombet accepted this revision.Oct 9 2020, 11:13 AM

Nice catch!

LGTM.

This revision is now accepted and ready to land.Oct 9 2020, 11:13 AM