[PATCH] D92127: [LiveDebugVariables] Strip all debug instructions from nodebug functions

Robert Lougher via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 25 13:00:52 PST 2020


rob.lougher created this revision.
rob.lougher added reviewers: aprantl, dblaikie, rnk.
Herald added a subscriber: hiraditya.
Herald added a project: LLVM.
rob.lougher requested review of this revision.

A crash/assertion failure in the greedy register allocator was tracked down to a debug instruction being passed to `LiveIntervals::getInstructionIndex`. Normally this should not occur as debug instructions are collected and removed by LiveDebugVariables before RA, and reinserted afterwards. However, when a function has no debug info, LiveDebugVariables simply strips any debug values that are present as they're not needed (this situation will occur when a function with debug info is inlined into a nodebug function). The problem is, it only removes `DBG_VALUE` instructions, leaving `DBG_LABEL`s (the cause of the crash).

This patch updates the LiveDebugVariables nodebug path to remove all debug instructions. The test case verifies that `DBG_VALUE`/`DBG_LABEL` instructions are present, and that they are stripped.

When `-experimental-debug-variable-locations` is enabled, certain variable locations are represented by `DBG_INSTR_REF` instead of `DBG_VALUE`. The test case verifies that a `DBG_INSTR_REF` is emitted by the option, and that it is also stripped.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D92127

Files:
  llvm/lib/CodeGen/LiveDebugVariables.cpp
  llvm/test/DebugInfo/X86/live-debug-vars-nodebug.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D92127.307680.patch
Type: text/x-patch
Size: 5144 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20201125/a55e2488/attachment.bin>


More information about the llvm-commits mailing list