[all-commits] [llvm/llvm-project] 6e0e92: [PowerPC] Converts to comparison against zero even...

Esme via All-commits all-commits at lists.llvm.org
Thu Sep 15 03:09:29 PDT 2022

  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 6e0e926c2f12f4897c91a90af61e06f410e528ef
  Author: esmeyi <esme.yi at ibm.com>
  Date:   2022-09-15 (Thu, 15 Sep 2022)

  Changed paths:
    M llvm/lib/Target/PowerPC/PPCInstrInfo.cpp
    M llvm/test/CodeGen/PowerPC/common-chain.ll
    M llvm/test/CodeGen/PowerPC/f128-aggregates.ll
    M llvm/test/CodeGen/PowerPC/loop-instr-form-prepare.ll
    M llvm/test/CodeGen/PowerPC/loop-instr-prep-non-const-increasement.ll
    M llvm/test/CodeGen/PowerPC/loop-p10-pair-prepare.ll
    M llvm/test/CodeGen/PowerPC/pr47373.ll
    M llvm/test/CodeGen/PowerPC/shrink-wrap.ll
    M llvm/test/CodeGen/PowerPC/spe.ll
    M llvm/test/CodeGen/PowerPC/store-constant.ll

  Log Message:
  [PowerPC] Converts to comparison against zero even when the optimization
          doesn't happened in peephole optimizer.

Summary: Converting a comparison against 1 or -1 into a comparison
against 0 can exploit record-form instructions for comparison optimization.
The conversion will happen only when a record-form instruction can be used
to replace the comparison during the peephole optimizer (see function optimizeCompareInstr).

In post-RA, we also want to optimize the comparison by using the record
form (see D131873) and it requires additional dataflow analysis to reliably
find uses of the CR register set.

It's reasonable to common the conversion for both peephole optimizer and
post-RA optimizer.

Converting to comparison against zero even when the optimization doesn't
happened in peephole optimizer may create additional opportunities for the
post-RA optimization.

Reviewed By: nemanjai

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

More information about the All-commits mailing list