[PATCH] D98564: [AArch64] Peephole rule to remove redundant cmp after cset.

Pavel Iliin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 12 15:34:19 PST 2021


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

Comparisons to zero or one after cset instructions can be safely
removed in examples like:

cset w9, eq          cset w9, eq
cmp  w9, #1   --->   <removed>
b.ne    .L1 <https://reviews.llvm.org/L1>          b.ne    .L1 <https://reviews.llvm.org/L1>

cset w9, eq          cset w9, eq
cmp  w9, #0   --->   <removed>
b.ne    .L1 <https://reviews.llvm.org/L1>          b.eq    .L1 <https://reviews.llvm.org/L1>

Peephole optimization to detect suitable cases and get rid of that
comparisons added.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D98564

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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D98564.330382.patch
Type: text/x-patch
Size: 16506 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210312/ba82e9de/attachment.bin>


More information about the llvm-commits mailing list