Page MenuHomePhabricator

[DebugInfo] Produce variadic DBG_INSTR_REFs from ISel
Needs ReviewPublic

Authored by StephenTozer on Sep 15 2022, 3:12 AM.

Details

Reviewers
jmorse
Orlando
Summary

This patch modifies SelectionDAG and FastISel to produce DBG_INSTR_REFs with variadic expressions, and produce DBG_INSTR_REFs for debug values with variadic location expressions. The former essentially means just prepending DW_OP_LLVM_arg, 0 to the existing expression. The latter is achieved in MachineFunction::finalizeDebugInstrRefs and InstrEmitter::EmitDbgInstrRef.

Diff Detail

Event Timeline

StephenTozer created this revision.Sep 15 2022, 3:12 AM
Herald added a project: Restricted Project. · View Herald TranscriptSep 15 2022, 3:12 AM
Herald added a subscriber: hiraditya. · View Herald Transcript
StephenTozer requested review of this revision.Sep 15 2022, 3:12 AM
Herald added a project: Restricted Project. · View Herald TranscriptSep 15 2022, 3:12 AM

Generally looks good -- needs tests though.

llvm/lib/CodeGen/SelectionDAG/InstrEmitter.cpp
826–828

Haven't these all been excluded due to IsInvalidOp?

jmorse requested changes to this revision.Sep 16 2022, 9:54 AM
This revision now requires changes to proceed.Sep 16 2022, 9:54 AM

The "arg zero" form of DIExpression is going to be a very common case -- is it uniqued, and would it be worth storing a copy somewhere and just using that?

The "arg zero" form of DIExpression is going to be a very common case -- is it uniqued, and would it be worth storing a copy somewhere and just using that?

DIExpressions should be uniqued based on their expression elements, and the get should just be a map lookup underneath, so I don't think there should be any issues with duplicate storage.

Rebased, fixed some errors when emitting undef values and update some tests accordingly.

Added some test coverage for SelectionDAG+FastISel emission of variadic instruction references.