This is an archive of the discontinued LLVM Phabricator instance.

[XRay] Fix machine verifier issues in X86
ClosedPublic

Authored by thegameg on Jul 11 2018, 7:35 AM.

Details

Summary

I'm not sure if this fix is the right thing to do, but it seemed to me that PATCHABLE_RET and PATCHABLE_TAIL_CALL shouldn't have any defs.

Running the following:

LLVM_ENABLE_MACHINE_VERIFIER=1 ./build/bin/llvm-lit -v -a test/CodeGen/X86/xray-*

results in the following tests to fail (along others):

LLVM :: CodeGen/X86/xray-attribute-instrumentation.ll
LLVM :: CodeGen/X86/xray-custom-log.ll
LLVM :: CodeGen/X86/xray-log-args.ll
LLVM :: CodeGen/X86/xray-loop-detection.ll
LLVM :: CodeGen/X86/xray-multiplerets-in-blocks.mir
LLVM :: CodeGen/X86/xray-section-group.ll
LLVM :: CodeGen/X86/xray-selective-instrumentation.ll
LLVM :: CodeGen/X86/xray-tail-call-sled.ll
LLVM :: CodeGen/X86/xray-typed-event-log.ll

The errors are:

*** Bad machine code: Explicit definition must be a register ***
- function:    fn
- basic block: %bb.0  (0x7fa31a84d908)
- instruction: PATCHABLE_RET 2560, $eax
- operand 0:   2560

and

*** Bad machine code: Explicit definition must be a register ***
- function:    caller
- basic block: %bb.0  (0x7fbff3044108)
- instruction: PATCHABLE_TAIL_CALL 3009, @callee, <regmask $bh $bl $bp $bph $bpl $bx $ebp $ebx $hbp $hbx $rbp $rbx $r12 $r13 $r14 $r15 $r12b $r13b $r14b $r15b $r12bh $r13bh $r14bh $r15bh $r12d $r13d $r14d $r15d $r12w $r13w $r14w $r15w $r12wh and 3 more...>, implicit $rsp, implicit $ssp, implicit $rsp, implicit $ssp, implicit $edi
- operand 0:   3009

Diff Detail

Repository
rL LLVM

Event Timeline

thegameg created this revision.Jul 11 2018, 7:35 AM
dberris accepted this revision.Jul 11 2018, 5:20 PM

LGTM

This was my bad, as I was cargo-culting the definition from other pseudo-instructions. It hadn't occurred to me that these pseudo-instructions didn't need to have outputs defined.

Thanks!

This revision is now accepted and ready to land.Jul 11 2018, 5:20 PM
This revision was automatically updated to reflect the committed changes.