[all-commits] [llvm/llvm-project] c76c24: [DebugInfo][InstrRef] Remove a faulty assertion

Jeremy Morse via All-commits all-commits at lists.llvm.org
Fri Aug 20 06:24:13 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: c76c24e40b4abfeb12aeb094f81b311fef7b09ac
      https://github.com/llvm/llvm-project/commit/c76c24e40b4abfeb12aeb094f81b311fef7b09ac
  Author: Jeremy Morse <jeremy.morse at sony.com>
  Date:   2021-08-20 (Fri, 20 Aug 2021)

  Changed paths:
    M llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.cpp
    A llvm/test/DebugInfo/MIR/InstrRef/restore-to-rsp-crash.mir

  Log Message:
  -----------
  [DebugInfo][InstrRef] Remove a faulty assertion

This patch removes an assertion, and adds a regression test showing why the
assertion is broken.

For context, LocIdx is a key/index number for machine locations, so that we
can describe locations as a single integer and ignore whether they're on
the stack, in registers or otherwise. Back when InstrRefBasedLDV was added,
I happened to bake in a "special" zero number for various reasons, which
Vedant identified as undesirable in this review comment:
https://reviews.llvm.org/D83047#inline-765495 . I subsequently removed that
special zero number, but it looks like I didn't delete this assertion at
the time, which assumes that a zero LocIdx is invalid.

The attached test shows that this assertion is reachable on valid code --
on x86 $rsp always gets the LocIdx number zero, and if you transfer a
variable value into it, InstrRefBasedLDV crashes on that assertion. The
code might be a bit wild to be storing variables to $rsp like that, however
we shouldn't crash on it.

Differential Revision: https://reviews.llvm.org/D108134




More information about the All-commits mailing list