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

Nikita Popov via All-commits all-commits at lists.llvm.org
Wed Aug 18 20:07:47 PDT 2021


  Branch: refs/heads/release/13.x
  Home:   https://github.com/llvm/llvm-project
  Commit: b643ee1b9c1a8e0b81e31908a066c71851292890
      https://github.com/llvm/llvm-project/commit/b643ee1b9c1a8e0b81e31908a066c71851292890
  Author: Nikita Popov <nikita.ppv at gmail.com>
  Date:   2021-08-18 (Wed, 18 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

(cherry picked from commit 81b106584f2baf33e09be2362c35c1bf2f6bfe94)




More information about the All-commits mailing list