[PATCH] D63163: [GlobalISel][AArch64] Fold G_SUB into G_ICMP when it's safe to do so

Jessica Paquette via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 11 13:23:14 PDT 2019


paquette created this revision.
paquette added a reviewer: aemerson.
Herald added subscribers: Petar.Avramovic, hiraditya, kristof.beyls, javed.absar, rovka.
Herald added a project: LLVM.

Basically porting over the behaviour in AArch64ISelLowering to GISel. See emitComparison for reference.

When we have something like this:

  lhs = G_SUB 0, y
  ...
  G_ICMP lhs, rhs

We can fold away the G_SUB and produce a cmn instead, given that we produce the same value in NZCV.

Add a test showing that the transformation works, and also showing that we don't perform the transformation when it's unsafe.


https://reviews.llvm.org/D63163

Files:
  llvm/lib/Target/AArch64/AArch64InstructionSelector.cpp
  llvm/test/CodeGen/AArch64/GlobalISel/opt-fold-cmn.mir

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D63163.204148.patch
Type: text/x-patch
Size: 15813 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190611/665691bb/attachment.bin>


More information about the llvm-commits mailing list