[all-commits] [llvm/llvm-project] b54a8e: [InstCombine][DebugInfo] Fold constants wrapped in...

David via All-commits all-commits at lists.llvm.org
Thu Jan 30 06:50:55 PST 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: b54a8ec1bcd3689771c847cb37515b627034e518
      https://github.com/llvm/llvm-project/commit/b54a8ec1bcd3689771c847cb37515b627034e518
  Author: David Stenberg <david.stenberg at ericsson.com>
  Date:   2020-01-30 (Thu, 30 Jan 2020)

  Changed paths:
    M llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
    A llvm/test/Transforms/InstCombine/constant-fold-metadata-wrapped.ll

  Log Message:
  -----------
  [InstCombine][DebugInfo] Fold constants wrapped in metadata

Summary:
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.

Reviewers: jmorse, aprantl, vsk, davide

Reviewed By: aprantl, vsk, davide

Subscribers: hiraditya, llvm-commits

Tags: #debug-info, #llvm

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




More information about the All-commits mailing list