[PATCH] D89823: [AArch64][GlobalISel] Move imm adjustment for G_ICMP to post-legalizer lowering

Jessica Paquette via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 20 13:49:52 PDT 2020


paquette created this revision.
paquette added a reviewer: aemerson.
Herald added subscribers: danielkiss, hiraditya, kristof.beyls, rovka.
Herald added a project: LLVM.
paquette requested review of this revision.

Move the code which adjusts the immediate/predicate on a G_ICMP to AArch64PostLegalizerLowering.

This

- Reduces the number of places we need to test for optimized compares in the selector. We know that the compare should have been simplified by the time it hits the selector, so we can avoid testing this in selects, brconds, etc.

- Allows us to potentially fold more compares (previously, this optimization was only done after calling `tryFoldCompare`, this may allow us to hit some more TST cases)

- Simplifies the selection code in `emitIntegerCompare` significantly; we can just use an emitSUBS function.

- Allows us to avoid checking that the predicate has been updated after `emitIntegerCompare`.

Also add a utility header file for things that may be useful in the selector and various combiners. No need for an implementation file at this point, since it's just one constexpr function for now. I've run into a couple cases where having one of these would be handy, so might as well add it here. There are a couple functions in the selector that can probably be factored out into here.


https://reviews.llvm.org/D89823

Files:
  llvm/lib/Target/AArch64/AArch64Combine.td
  llvm/lib/Target/AArch64/GISel/AArch64GlobalISelUtils.h
  llvm/lib/Target/AArch64/GISel/AArch64InstructionSelector.cpp
  llvm/lib/Target/AArch64/GISel/AArch64PostLegalizerLowering.cpp
  llvm/test/CodeGen/AArch64/GlobalISel/fold-select.mir
  llvm/test/CodeGen/AArch64/GlobalISel/postlegalizer-lowering-adjust-icmp-imm.mir
  llvm/test/CodeGen/AArch64/GlobalISel/select-arith-immed-compare.mir
  llvm/test/CodeGen/AArch64/GlobalISel/select-cbz.mir
  llvm/test/CodeGen/AArch64/GlobalISel/tbz-sgt.mir

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D89823.299461.patch
Type: text/x-patch
Size: 62766 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20201020/067c1432/attachment-0001.bin>


More information about the llvm-commits mailing list