[all-commits] [llvm/llvm-project] ae597a: [AArch64][GlobalISel] Do not modify predicate when...

Jessica Paquette via All-commits all-commits at lists.llvm.org
Tue May 26 17:52:01 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: ae597a771ed4d7530e2ef232d02a253067e3312f
      https://github.com/llvm/llvm-project/commit/ae597a771ed4d7530e2ef232d02a253067e3312f
  Author: Jessica Paquette <jpaquette at apple.com>
  Date:   2020-05-26 (Tue, 26 May 2020)

  Changed paths:
    M llvm/lib/Target/AArch64/AArch64InstructionSelector.cpp
    M llvm/test/CodeGen/AArch64/GlobalISel/select-arith-immed-compare.mir

  Log Message:
  -----------
  [AArch64][GlobalISel] Do not modify predicate when optimizing G_ICMP

This fixes a bug in `tryOptArithImmedIntegerCompare`.

It is unsafe to update the predicate on a MachineOperand when optimizing a
G_ICMP, because it may be used in more than one place.

For example, when we are optimizing G_SELECT, we allow compares which are used
in more than one G_SELECT. If we modify the G_ICMP, then we'll break one of
the G_SELECTs.

Since the compare is being produced to either

1) Select a G_ICMP
2) Fold a G_ICMP into an instruction when profitable

there's no reason to actually modify it. The change is local to the specific
compare.

Instead, pass a `CmpInst::Predicate` to `tryOptArithImmedIntegerCompare` which
can be modified by reference.

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




More information about the All-commits mailing list