[all-commits] [llvm/llvm-project] 2d6a5a: [X86]Recommit D154193 - Remove TEST in AND32ri+TES...

XinWang10 via All-commits all-commits at lists.llvm.org
Fri Jul 14 00:45:07 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 2d6a5ab5ebd4907fe3bb2ee67574fd672ad80bd8
      https://github.com/llvm/llvm-project/commit/2d6a5ab5ebd4907fe3bb2ee67574fd672ad80bd8
  Author: XinWang10 <xin10.wang at intel.com>
  Date:   2023-07-14 (Fri, 14 Jul 2023)

  Changed paths:
    M llvm/lib/Target/X86/X86InstrInfo.cpp
    M llvm/test/CodeGen/X86/peephole-test-after-add.mir

  Log Message:
  -----------
  [X86]Recommit D154193 - Remove TEST in AND32ri+TEST16rr in peephole-opt

Previously we remove a pattern like:
  %reg = and32ri %in_reg, 5
  ...                         // EFLAGS not changed.
  %src_reg = subreg_to_reg 0, %reg, %subreg.sub_index
  test64rr %src_reg, %src_reg, implicit-def $eflags
We can remove test64rr since it has same functionality as and subreg_to_reg avoid the opt in previous code, so we handle this case specially.
And this case is also can be opted for the same reason, like:
  %reg = and32ri %in_reg, 5
  ...                         // EFLAGS not changed.
  %src_reg = copy %reg.sub_16bit:gr32
  test16rr %src_reg, %src_reg, implicit-def $eflags
The COPY from gr32 to gr16 prevent the opt in previous code too, just handle it specially as what we did for test64rr.

Reviewed By: skan

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




More information about the All-commits mailing list