[all-commits] [llvm/llvm-project] e547a3: [DeadArgElim] Set unused arguments for internal fu...

qcolombet via All-commits all-commits at lists.llvm.org
Mon May 2 11:16:54 PDT 2022

  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: e547a333a43348a8a7ec9460f37696ecc5453e56
  Author: Quentin Colombet <qcolombet at apple.com>
  Date:   2022-05-02 (Mon, 02 May 2022)

  Changed paths:
    M llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp
    A llvm/test/Transforms/DeadArgElim/fct_ptr.ll

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

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