[all-commits] [llvm/llvm-project] dd71b6: [llvm-reduce] Introduce operands-to-args pass.

Michael Kruse via All-commits all-commits at lists.llvm.org
Wed Oct 13 07:58:17 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: dd71b65ca85dd2f80aca3ad0f0235180580f5824
      https://github.com/llvm/llvm-project/commit/dd71b65ca85dd2f80aca3ad0f0235180580f5824
  Author: Michael Kruse <llvm-project at meinersbur.de>
  Date:   2021-10-13 (Wed, 13 Oct 2021)

  Changed paths:
    A llvm/test/tools/llvm-reduce/operands-to-args.ll
    M llvm/test/tools/llvm-reduce/remove-call-site-attributes.ll
    M llvm/tools/llvm-reduce/CMakeLists.txt
    M llvm/tools/llvm-reduce/DeltaManager.cpp
    A llvm/tools/llvm-reduce/deltas/ReduceOperandsToArgs.cpp
    A llvm/tools/llvm-reduce/deltas/ReduceOperandsToArgs.h

  Log Message:
  -----------
  [llvm-reduce] Introduce operands-to-args pass.

Instead of setting operands to undef as the "operands" pass does,
convert the operands to a function argument. This avoids having to
introduce undef values into the IR which have some unpredictability
during optimizations.

For instance,

    define void @func() {
    entry:
      %val = add i32 32, 21
      store i32 %val, i32* null
      ret void
    }

is reduced to

    define void @func(i32 %val) {
    entry:
      %val1 = add i32 32, 21
      store i32 %val, i32* null
      ret void
    }

(note that the instruction %val is renamed to %val1 when printing
the IR to avoid ambiguity; ideally %val1 would be removed by dce or the
instruction reduction pass)

Any call to @func is replaced with a call to the function with the
new signature and filled with undef. This is not ideal for IPA passes,
but those out-of-scope for now.

Reviewed By: aeubanks

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




More information about the All-commits mailing list