This is an archive of the discontinued LLVM Phabricator instance.

[DebugInfo][AArch64] Recognise target specific instruction as mov instr
ClosedPublic

Authored by avl on May 16 2019, 1:23 PM.

Details

Summary

This fix is for the problem from https://bugs.llvm.org/show_bug.cgi?id=38714.
Specifically, Simple Register Coalescing creates following conversion :

    
undef %0.sub_32:gpr64 = ORRWrs $wzr, %3:gpr32common, 0, debug-location !24;

It copies 32-bit value from gpr32 into gpr64. But Live DEBUG_VALUE analysis
is not able to create debug location record for that instruction. So the problem
is in that debug location for argc variable is incorrect. The fix is
to write custom isCopyInstrImpl() which would recognize the ORRWrs instr.

Diff Detail

Event Timeline

avl created this revision.May 16 2019, 1:23 PM
efriedma added inline comments.May 16 2019, 4:52 PM
llvm/lib/Target/AArch64/AArch64InstrInfo.cpp
5519

I don't think we'll produce an ORRXrs until after it's relevant here, but I guess it's safe enough.

You need to check that the instruction is actually a "mov"; it looks like you're correctly checking that the shift amount is zero, but you aren't checking that the other register is wzr/xzr.

llvm/test/CodeGen/AArch64/aarch64-mov-debug-locs.ll
24 ↗(On Diff #199887)

Can you make an MIR testcase using -run-pass instead of running the complete llc pipeline?

avl updated this revision to Diff 200287.May 20 2019, 8:14 AM

addressed comments: added check for WZR/XZR registers, changed test to run only LiveDebugValues pass.

efriedma added inline comments.May 20 2019, 12:24 PM
llvm/lib/Target/AArch64/AArch64InstrInfo.cpp
5521

The isReg/isImm checks aren't necessary; the legal operands are determined by the opcode.

avl updated this revision to Diff 200445.May 21 2019, 2:52 AM

deleted redundant check.

efriedma accepted this revision.May 21 2019, 11:57 AM

LGTM with one minor comment

llvm/lib/Target/AArch64/AArch64InstrInfo.cpp
5523

Please clean up unnecessary parentheses (you don't need parentheses around each comparison using "&&").

This revision is now accepted and ready to land.May 21 2019, 11:57 AM
avl closed this revision.May 27 2019, 2:47 AM