[PATCH] D73630: [InstCombine][DebugInfo] Fold constants wrapped in metadata

David Stenberg via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 29 07:58:08 PST 2020


dstenb created this revision.
dstenb added reviewers: jmorse, aprantl, vsk, davide.
dstenb added a project: debug-info.
Herald added subscribers: llvm-commits, hiraditya.
Herald added a project: LLVM.

When constant folding, constants that are wrapped in metadata were not
folded. This could lead to dbg.values being the only user of a constant
expression, due to the non-dbg uses having been rewritten, resulting in
the constant later on being removed by some other pass. This occurred
with the attached test case, in which the non-rewritten GEP in the
dbg.value intrinsic was later on removed by globalopt.

This patch makes the code look through metadata and fold such constants.

I guess that we in the future may want to allow dbg.values using GEPs and
other constant expressions to be emittable even if there are no non-dbg
uses, but for example SelectionDAG does not support that.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D73630

Files:
  llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
  llvm/test/Transforms/InstCombine/constant-fold-metadata-wrapped.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D73630.241162.patch
Type: text/x-patch
Size: 4511 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200129/1f319253/attachment.bin>


More information about the llvm-commits mailing list