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

Matt Arsenault via All-commits all-commits at lists.llvm.org
Thu Mar 27 20:11:01 PDT 2025


  Branch: refs/heads/users/arsenm/llvm-reduce/add-reduce-values-to-return-reduction
  Home:   https://github.com/llvm/llvm-project
  Commit: c2348c523d53cfa4a5ffbfc0ba5771a6c9433e85
      https://github.com/llvm/llvm-project/commit/c2348c523d53cfa4a5ffbfc0ba5771a6c9433e85
  Author: Matt Arsenault <Matthew.Arsenault at amd.com>
  Date:   2025-03-27 (Thu, 27 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
    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: bf2a03a3f95077ffc96dc13ee0a8791a731bb5a5
      https://github.com/llvm/llvm-project/commit/bf2a03a3f95077ffc96dc13ee0a8791a731bb5a5
  Author: Matt Arsenault <Matthew.Arsenault at amd.com>
  Date:   2025-03-27 (Thu, 27 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: 21c95b7d7d4cccc29cab4ee230c3af0a5b0e96c5
      https://github.com/llvm/llvm-project/commit/21c95b7d7d4cccc29cab4ee230c3af0a5b0e96c5
  Author: Matt Arsenault <Matthew.Arsenault at amd.com>
  Date:   2025-03-27 (Thu, 27 Mar 2025)

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

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


  Commit: 298d6ee4becebe7dfb993b70805f3ae4a2247eab
      https://github.com/llvm/llvm-project/commit/298d6ee4becebe7dfb993b70805f3ae4a2247eab
  Author: Matt Arsenault <Matthew.Arsenault at amd.com>
  Date:   2025-03-28 (Fri, 28 Mar 2025)

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

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


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

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