[all-commits] [llvm/llvm-project] dba29f: [AArch64][GlobalISel] Fold G_AND into G_BRCOND

Jessica Paquette via All-commits all-commits at lists.llvm.org
Tue Jan 28 14:02:16 PST 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: dba29f7c3b36443c7287ba5a31d166f8edb73544
      https://github.com/llvm/llvm-project/commit/dba29f7c3b36443c7287ba5a31d166f8edb73544
  Author: Jessica Paquette <jpaquette at apple.com>
  Date:   2020-01-28 (Tue, 28 Jan 2020)

  Changed paths:
    M llvm/lib/Target/AArch64/AArch64InstructionSelector.cpp
    A llvm/test/CodeGen/AArch64/GlobalISel/opt-and-tbnz-tbz.mir

  Log Message:
  -----------
  [AArch64][GlobalISel] Fold G_AND into G_BRCOND

When the G_BRCOND is fed by a 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.

Differential Revision: https://reviews.llvm.org/D73573




More information about the All-commits mailing list