[all-commits] [llvm/llvm-project] 81b106: [AArch64] Fix comparison peephole opt with non-0/1...

Nikita Popov via All-commits all-commits at lists.llvm.org
Sun Aug 15 03:42:17 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 81b106584f2baf33e09be2362c35c1bf2f6bfe94
      https://github.com/llvm/llvm-project/commit/81b106584f2baf33e09be2362c35c1bf2f6bfe94
  Author: Nikita Popov <nikita.ppv at gmail.com>
  Date:   2021-08-15 (Sun, 15 Aug 2021)

  Changed paths:
    M llvm/lib/Target/AArch64/AArch64InstrInfo.cpp
    M llvm/test/CodeGen/AArch64/csinc-cmp-removal.mir
    A llvm/test/CodeGen/AArch64/pr51476.ll

  Log Message:
  -----------
  [AArch64] Fix comparison peephole opt with non-0/1 immediate (PR51476)

This is a non-intrusive fix for
https://bugs.llvm.org/show_bug.cgi?id=51476 intended for backport
to the 13.x release branch. It expands on the current hack by
distinguishing between CmpValue of 0, 1 and 2, where 0 and 1 have
the obvious meaning and 2 means "anything else". The new optimization
from D98564 should only be performed for CmpValue of 0 or 1.

For main, I think we should switch the analyzeCompare() and
optimizeCompare() APIs to use int64_t instead of int, which is in
line with MachineOperand's notion of an immediate, and avoids this
problem altogether.

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




More information about the All-commits mailing list