[PATCH] D41043: Support for an intrinsic "fake.use" (and corresponding operand) representing a use of an operand to aid debugging

Wolfgang Pieb via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 8 17:19:46 PST 2017


wolfgangp created this revision.
Herald added a subscriber: JDevlieghere.

The patch presents the implementation of the "FAKE USE" concept I presented in my lightning talk "Debugging of optimized code:  Extending the lifetime of local variables" at the October 2017 LLVM developers' conference. Since the concept is not universally supported, the purpose of this review is to make the patch available to interested parties, and perhaps to restart the discussion.

There is a review for the corresponding clang patch, which implements the -fextend-lifetime and -fextend-this-ptr options. These options make clang generate fake uses of local variables. I will add the URL here as soon as I have posted it.

Regarding the implementation, it is a relatively straightforward addition of the intrinsic and machine opcode. Some optimizations had to be suppressed for FAKE_USE operands because they would have affected debuggability. Note also that fake uses are not cloned during inlining, which does reduce their utility somewhat, but doing so led to a larger than acceptable performance degradation. There are probably ways to improve on this.


https://reviews.llvm.org/D41043

Files:
  include/llvm/Analysis/PtrUseVisitor.h
  include/llvm/CodeGen/ISDOpcodes.h
  include/llvm/CodeGen/MachineInstr.h
  include/llvm/CodeGen/SelectionDAGISel.h
  include/llvm/CodeGen/TargetOpcodes.def
  include/llvm/IR/Intrinsics.td
  include/llvm/Target/Target.td
  lib/CodeGen/AsmPrinter/AsmPrinter.cpp
  lib/CodeGen/DeadMachineInstructionElim.cpp
  lib/CodeGen/MachineCSE.cpp
  lib/CodeGen/SelectionDAG/FastISel.cpp
  lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp
  lib/CodeGen/SelectionDAG/LegalizeTypes.h
  lib/CodeGen/SelectionDAG/LegalizeTypesGeneric.cpp
  lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp
  lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
  lib/CodeGen/SelectionDAG/SelectionDAGDumper.cpp
  lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
  lib/IR/Verifier.cpp
  lib/Target/X86/X86FloatingPoint.cpp
  lib/Transforms/Utils/CloneFunction.cpp
  lib/Transforms/Utils/Local.cpp
  lib/Transforms/Utils/PromoteMemoryToRegister.cpp
  test/DebugInfo/X86/Inputs/check-fake-use.py
  test/DebugInfo/X86/fake-use.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D41043.126246.patch
Type: text/x-patch
Size: 29431 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171209/084652b9/attachment.bin>


More information about the llvm-commits mailing list