[all-commits] [llvm/llvm-project] 84e245: llvm-reduce: Add values to return reduction

Matt Arsenault via All-commits all-commits at lists.llvm.org
Fri May 2 07:08:49 PDT 2025


  Branch: refs/heads/users/arsenm/llvm-reduce/add-reduce-values-to-return-reduction
  Home:   https://github.com/llvm/llvm-project
  Commit: 84e245556f2f5879587c17b28dbbd84ab4aa771c
      https://github.com/llvm/llvm-project/commit/84e245556f2f5879587c17b28dbbd84ab4aa771c
  Author: Matt Arsenault <Matthew.Arsenault at amd.com>
  Date:   2025-05-02 (Fri, 02 May 2025)

  Changed paths:
    M llvm/include/llvm/IR/Function.h
    M llvm/lib/IR/Function.cpp
    M llvm/test/tools/llvm-reduce/reduce-operands-fp.ll
    M llvm/test/tools/llvm-reduce/reduce-operands-int.ll
    M llvm/test/tools/llvm-reduce/reduce-operands-ptr.ll
    A llvm/test/tools/llvm-reduce/reduce-values-to-return.ll
    M llvm/tools/llvm-reduce/CMakeLists.txt
    M llvm/tools/llvm-reduce/DeltaManager.cpp
    M llvm/tools/llvm-reduce/DeltaPasses.def
    A llvm/tools/llvm-reduce/deltas/ReduceValuesToReturn.cpp
    A llvm/tools/llvm-reduce/deltas/ReduceValuesToReturn.h

  Log Message:
  -----------
  llvm-reduce: Add values to return reduction

In void functions, try to replace instruction uses
with a new non-void return. If the return type matches
the instruction, also try to directly return it.

This handles most of the cases, but doesn't try to handle
all of the weird exception related terminators.

Also doesn't try to replace argument uses, although it could. We
could also handle cases where we can insert a simple cast to an
original return value. I didn't think too hard about where to put this
in the default pass order. In many cases it obviates the need for most
of the CFG folds, but I've left it near the end initially.

I also think this is too aggressive about removing dead code, and
should leave existing dead code alone. I'm also not sure why we have
both "removeUnreachableBlocks" and EliminateUnreachableBlocks" in Utils.

Fixes #66039, fixes #107327


  Commit: 7ccdddad402f324932f3ce332c58d745516a4950
      https://github.com/llvm/llvm-project/commit/7ccdddad402f324932f3ce332c58d745516a4950
  Author: Matt Arsenault <Matthew.Arsenault at amd.com>
  Date:   2025-05-02 (Fri, 02 May 2025)

  Changed paths:
    A llvm/test/tools/llvm-reduce/reduce-values-to-return-nonvoid-noncallee-use.ll
    M llvm/tools/llvm-reduce/deltas/ReduceValuesToReturn.cpp

  Log Message:
  -----------
  Fix non-void return typed non-callee uses


  Commit: fea16ee013bac3d97e93fa28cc5db6583bf79548
      https://github.com/llvm/llvm-project/commit/fea16ee013bac3d97e93fa28cc5db6583bf79548
  Author: Matt Arsenault <Matthew.Arsenault at amd.com>
  Date:   2025-05-02 (Fri, 02 May 2025)

  Changed paths:
    M llvm/tools/llvm-reduce/deltas/ReduceValuesToReturn.cpp

  Log Message:
  -----------
  Add const


  Commit: 628a07d935c085b777f2200dfc1a24f1338a95fd
      https://github.com/llvm/llvm-project/commit/628a07d935c085b777f2200dfc1a24f1338a95fd
  Author: Matt Arsenault <Matthew.Arsenault at amd.com>
  Date:   2025-05-02 (Fri, 02 May 2025)

  Changed paths:
    M llvm/tools/llvm-reduce/deltas/ReduceValuesToReturn.cpp

  Log Message:
  -----------
  refactor


  Commit: 27cf587983b4853895aac29ef4a21d8624996977
      https://github.com/llvm/llvm-project/commit/27cf587983b4853895aac29ef4a21d8624996977
  Author: Matt Arsenault <Matthew.Arsenault at amd.com>
  Date:   2025-05-02 (Fri, 02 May 2025)

  Changed paths:
    M llvm/tools/llvm-reduce/deltas/ReduceValuesToReturn.cpp

  Log Message:
  -----------
  Remove blank line


  Commit: a255a996273d218c6432e765e8a6e01c8b0970cd
      https://github.com/llvm/llvm-project/commit/a255a996273d218c6432e765e8a6e01c8b0970cd
  Author: Matt Arsenault <Matthew.Arsenault at amd.com>
  Date:   2025-05-02 (Fri, 02 May 2025)

  Changed paths:
    M llvm/test/tools/llvm-reduce/reduce-values-to-return-nonvoid-noncallee-use.ll
    M llvm/test/tools/llvm-reduce/reduce-values-to-return.ll
    M llvm/tools/llvm-reduce/DeltaPasses.def
    M llvm/tools/llvm-reduce/deltas/ReduceValuesToReturn.h

  Log Message:
  -----------
  Fix build


  Commit: 42bee657fdb41a76b0668cfc719bc803d84ca4ee
      https://github.com/llvm/llvm-project/commit/42bee657fdb41a76b0668cfc719bc803d84ca4ee
  Author: Matt Arsenault <Matthew.Arsenault at amd.com>
  Date:   2025-05-02 (Fri, 02 May 2025)

  Changed paths:
    A llvm/test/tools/llvm-reduce/reduce-instructions-to-return-nonvoid-noncallee-use.ll
    A llvm/test/tools/llvm-reduce/reduce-instructions-to-return.ll
    R llvm/test/tools/llvm-reduce/reduce-values-to-return-nonvoid-noncallee-use.ll
    R llvm/test/tools/llvm-reduce/reduce-values-to-return.ll

  Log Message:
  -----------
  Rename tests


  Commit: e9887c1b8d62e2b64bd20f7acc78d84b1e36e494
      https://github.com/llvm/llvm-project/commit/e9887c1b8d62e2b64bd20f7acc78d84b1e36e494
  Author: Matt Arsenault <Matthew.Arsenault at amd.com>
  Date:   2025-05-02 (Fri, 02 May 2025)

  Changed paths:
    M llvm/tools/llvm-reduce/deltas/ReduceValuesToReturn.cpp

  Log Message:
  -----------
  llvm-reduce: Use splice and remap instead of clone


  Commit: 7f404540020599ff7fcfea4f3a8679cddc914cda
      https://github.com/llvm/llvm-project/commit/7f404540020599ff7fcfea4f3a8679cddc914cda
  Author: Matt Arsenault <Matthew.Arsenault at amd.com>
  Date:   2025-05-02 (Fri, 02 May 2025)

  Changed paths:
    M llvm/tools/llvm-reduce/deltas/ReduceValuesToReturn.cpp

  Log Message:
  -----------
  Avoid ValueMapper


  Commit: f2584ca43778bea195dc252a9fa7cb6b551142be
      https://github.com/llvm/llvm-project/commit/f2584ca43778bea195dc252a9fa7cb6b551142be
  Author: Matt Arsenault <Matthew.Arsenault at amd.com>
  Date:   2025-05-02 (Fri, 02 May 2025)

  Changed paths:
    M llvm/tools/llvm-reduce/deltas/ReduceValuesToReturn.cpp

  Log Message:
  -----------
  Use takeName


Compare: https://github.com/llvm/llvm-project/compare/754dc68c299f...f2584ca43778

To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list