[all-commits] [llvm/llvm-project] 526c51: [DwarfDebug] Fix an assertion error when emitting ...

Vedant Kumar via All-commits all-commits at lists.llvm.org
Tue Mar 17 12:52:23 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 526c51e6fdc834b703e14ca851a8c95c7f1c9b2f
      https://github.com/llvm/llvm-project/commit/526c51e6fdc834b703e14ca851a8c95c7f1c9b2f
  Author: Vedant Kumar <vsk at apple.com>
  Date:   2020-03-17 (Tue, 17 Mar 2020)

  Changed paths:
    M llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
    M llvm/lib/IR/DebugInfoMetadata.cpp
    A llvm/test/DebugInfo/MIR/X86/callsite-stack-value.mir

  Log Message:
  -----------
  [DwarfDebug] Fix an assertion error when emitting call site info that combines two DW_OP_stack_values

When compiling

```
struct S {
  float w;
};
void f(long w, long b);
void g(struct S s) {
  int w = s.w;
  f(w, w*4);
}
```

I get Assertion failed: ((!CombinedExpr || CombinedExpr->isValid()) && "Combined debug expression is invalid").

That's because we combine two epxressions that both end in DW_OP_stack_value:

```
(lldb) p Expr->dump()
!DIExpression(DW_OP_LLVM_convert, 32, DW_ATE_signed, DW_OP_LLVM_convert, 64, DW_ATE_signed, DW_OP_stack_value)
(lldb) p Param.Expr->dump()
!DIExpression(DW_OP_constu, 4, DW_OP_mul, DW_OP_LLVM_convert, 32, DW_ATE_signed, DW_OP_LLVM_convert, 64, DW_ATE_signed, DW_OP_stack_value)
(lldb) p CombinedExpr->isValid()
(bool) $0 = false
(lldb) p CombinedExpr->dump()
!DIExpression(4097, 32, 5, 4097, 64, 5, 16, 4, 30, 4097, 32, 5, 4097, 64, 5, 159, 159)
```

I believe that in this particular case combining two stack values is
safe, but I didn't want to sink the special handling into
DIExpression::append() because I do want everyone to think about what
they are doing.

Patch by Adrian Prantl.

Fixes PR45181.
rdar://problem/60383095

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




More information about the All-commits mailing list