[PATCH] D85555: [InstCombine] Remove dbg.values describing contents of dead allocas

Adrian Prantl via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 1 11:42:15 PDT 2020


aprantl added a comment.

I believe that the following could work and be a self-contained local operation that doesn't need any contract with a previous optimization pass:

  %a = alloca i32              ; This alloca is erased.
  store i32 %0, i32* %a
  dbg.value(i32* %a, "arg0", DW_OP_deref)
  call void @trivially_inlinable_no_op(i32* %a)

We could define a new type //salvage// operation that looks at to-be-deleted `store foo, a` instructions that store to an `alloca a` that is used in a `dbg.value(a, var, DIExpression(DW_OP_deref, expr))` that is //following// the store. It would salvage the store by replacing the dbg.value with `dbg.value(foo, var, DIExpression(expr))`.

This example would become

  dbg.value(i32* %0, "arg0", DIExpression())
  call void @trivially_inlinable_no_op(i32* %a)

That would also apply to any store to `a` inside the function after inlining.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D85555



More information about the llvm-commits mailing list