[PATCH] D111503: [llvm-reduce] Introduce operands-to-args pass.

Michael Kruse via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Oct 9 20:47:30 PDT 2021


Meinersbur created this revision.
Meinersbur added reviewers: aeubanks, hans, nikic, swamulism, dblaikie, nickdesaulniers, lebedev.ri, regehr.
Herald added subscribers: jdoerfert, mgorny.
Meinersbur requested review of this revision.
Herald added a project: LLVM.

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.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D111503

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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D111503.378488.patch
Type: text/x-patch
Size: 12242 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211010/fe8d4ac1/attachment.bin>


More information about the llvm-commits mailing list