[PATCH] D63656: [Peephole] Allow folding loads into instructions w/multiple uses (such as test64rr)

Philip Reames via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 21 09:29:08 PDT 2019


reames created this revision.
reames added reviewers: skatkov, spatel, craig.topper.
Herald added subscribers: jfb, bollu, mcrosier.
Herald added a project: LLVM.

Peephole opt has a one use limitation which appears to be accidental.  The function being used was incorrectly documented as returning whether the def had one *user*, but instead returned true only when there was one *use*.  Add a corresponding hasOneNonDbgUser helper, and adjust peephole-opt to use the appropriate one.

All of the actual folding code handles multiple uses within a single instruction.  That codepath is well exercised through instruction selection.

The practical benefit of this is mostly restricted to atomics since our instruction selection is currently very conservative, but in theory, it can catch anything instruction selection might have missed or another pass inserted.


Repository:
  rL LLVM

https://reviews.llvm.org/D63656

Files:
  include/llvm/CodeGen/MachineRegisterInfo.h
  lib/CodeGen/MachineRegisterInfo.cpp
  lib/CodeGen/PeepholeOptimizer.cpp
  test/CodeGen/X86/peephole-fold-testrr.mir

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D63656.206023.patch
Type: text/x-patch
Size: 5354 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190621/6d81c19a/attachment.bin>


More information about the llvm-commits mailing list