[all-commits] [llvm/llvm-project] 9766fe: [DeadArgElim] Re-apply: Set unused arguments for i...

qcolombet via All-commits all-commits at lists.llvm.org
Thu May 12 08:56:18 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 9766fed9c10e8ba2f67fad0a3e8b509a8064f7b3
      https://github.com/llvm/llvm-project/commit/9766fed9c10e8ba2f67fad0a3e8b509a8064f7b3
  Author: Quentin Colombet <qcolombet at apple.com>
  Date:   2022-05-12 (Thu, 12 May 2022)

  Changed paths:
    M clang/test/CodeGen/debug-info-block-vars.c
    M clang/test/CodeGenObjCXX/nrvo.mm
    M llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp
    A llvm/test/Transforms/DeadArgElim/fct_ptr.ll

  Log Message:
  -----------
  [DeadArgElim] Re-apply: Set unused arguments for internal functions

The re-apply includes fixes to clang tests that were missed in
the original commit.

Original message:
Prior to this patch we would only set to undef the unused arguments of the
external functions. The rationale was that unused arguments of internal
functions wouldn't need to be turned into undef arguments because they
should have been simply eliminated by the time we reach that code.

This is actually not true because there are plenty of cases where we can't
remove unused arguments. For instance, if the internal function is used in
an indirect call, it may not be possible to change the function signature.
Yet, for statically known call-sites we would still like to mark the unused
arguments as undef.

This patch enables the "set undef arguments" optimization on internal
functions when we encounter cases where internal functions cannot be
optimized. I.e., whenever an internal function is marked "live".

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




More information about the All-commits mailing list