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

Matt Arsenault via All-commits all-commits at lists.llvm.org
Sun Mar 30 00:41:57 PDT 2025


  Branch: refs/heads/users/arsenm/llvm-reduce/add-reduce-values-to-return-reduction
  Home:   https://github.com/llvm/llvm-project
  Commit: 0168563527d3f326612dc24c460c24b166e1307e
      https://github.com/llvm/llvm-project/commit/0168563527d3f326612dc24c460c24b166e1307e
  Author: Matt Arsenault <Matthew.Arsenault at amd.com>
  Date:   2025-03-30 (Sun, 30 Mar 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: 9203887a3e9a5e701f770b671d10a3ef54fe13d0
      https://github.com/llvm/llvm-project/commit/9203887a3e9a5e701f770b671d10a3ef54fe13d0
  Author: Matt Arsenault <Matthew.Arsenault at amd.com>
  Date:   2025-03-30 (Sun, 30 Mar 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: 3e8d348d8627dbdb718947b835aafc9c3183f3bf
      https://github.com/llvm/llvm-project/commit/3e8d348d8627dbdb718947b835aafc9c3183f3bf
  Author: Matt Arsenault <Matthew.Arsenault at amd.com>
  Date:   2025-03-30 (Sun, 30 Mar 2025)

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

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


  Commit: f496891bc1543f094ca3dec9536a63918eafb4c9
      https://github.com/llvm/llvm-project/commit/f496891bc1543f094ca3dec9536a63918eafb4c9
  Author: Matt Arsenault <Matthew.Arsenault at amd.com>
  Date:   2025-03-30 (Sun, 30 Mar 2025)

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

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


Compare: https://github.com/llvm/llvm-project/compare/298d6ee4bece...f496891bc154

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