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

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Aug 14 14:51:33 PDT 2021


nikic created this revision.
nikic added reviewers: ilinpv, dmgreen, paquette.
Herald added subscribers: hiraditya, kristof.beyls.
nikic requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

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 <https://reviews.llvm.org/D98564> should only be performed for CmpValue of 0 or 1.

For main, I think we should switch the analyzeCompare() + 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.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D108076

Files:
  llvm/lib/Target/AArch64/AArch64InstrInfo.cpp
  llvm/test/CodeGen/AArch64/csinc-cmp-removal.mir
  llvm/test/CodeGen/AArch64/pr51476.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D108076.366458.patch
Type: text/x-patch
Size: 5665 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210814/f10663c7/attachment.bin>


More information about the llvm-commits mailing list