[PATCH] D73573: [AArch64][GlobalISel] Fold G_AND into G_BRCOND

Jessica Paquette via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 28 12:11:31 PST 2020


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

When a G_BRCOND is fed by an eq or ne G_ICMP, it may be possible to fold a G_AND into the branch by producing a tbnz/tbz instead.

This happens when

1. We have a ne/eq G_ICMP feeding into the G_BRCOND
2. The G_ICMP is a comparison against 0
3. One of the operands of the G_AND is a power of 2 constant

This is very similar to the code in AArch64TargetLowering::LowerBR_CC.

Add opt-and-tbnz-tbz to test this.

(I think that we can probably factor out all the CB(N)Z into a function like this, but I want to finish implementing the other parts of AArch64TargetLowering::LowerBR_CC first.)


https://reviews.llvm.org/D73573

Files:
  llvm/lib/Target/AArch64/AArch64InstructionSelector.cpp
  llvm/test/CodeGen/AArch64/GlobalISel/opt-and-tbnz-tbz.mir

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D73573.240964.patch
Type: text/x-patch
Size: 11934 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200128/efc9b5e1/attachment.bin>


More information about the llvm-commits mailing list