[PATCH] D158185: [DebugInfo] Process single-location debug values in variadic form when producing DWARF

Stephen Tozer via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 8 04:57:09 PDT 2023


StephenTozer added inline comments.


================
Comment at: llvm/lib/IR/DebugInfoMetadata.cpp:1353
 bool DIExpression::startsWithDeref() const {
-  return getNumElements() > 0 && getElement(0) == dwarf::DW_OP_deref;
+  auto singleLocElts = getSingleLocationExpressionElements();
+  return singleLocElts.size() > 0 && singleLocElts[0] == dwarf::DW_OP_deref;
----------------
Orlando wrote:
> Should these functions be asserting that they're not variadic?
That wasn't the original intent in this patch; the idea is that there's no difference between `DW_OP_LLVM_arg, 0, <ops>` in a variadic expression and `<ops>` in a non-variadic expression, so the goal of this patch is to treat those two as the same //even if// the expression ultimately is "truly" variadic, because we weren't already checking for variadic-ness here (so for correctness' sake we assume this is already being checked elsewhere), and the variadic check is more expensive.

However, I've found the patch triggers some errors when running on the llvm test suite, and the variadic check really isn't that expensive I think, so I'm going to rewrite the patch to do a bit more.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D158185/new/

https://reviews.llvm.org/D158185



More information about the llvm-commits mailing list