[all-commits] [llvm/llvm-project] 8699ef: [AArch64][SVE] Fix bad PTEST(PTRUE_ALL, PTEST_LIKE...

Cullen Rhodes via All-commits all-commits at lists.llvm.org
Tue Nov 15 04:43:42 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 8699efba6dc8d905d144727eb10ff6782376bb87
      https://github.com/llvm/llvm-project/commit/8699efba6dc8d905d144727eb10ff6782376bb87
  Author: Cullen Rhodes <cullen.rhodes at arm.com>
  Date:   2022-11-15 (Tue, 15 Nov 2022)

  Changed paths:
    M llvm/lib/Target/AArch64/AArch64InstrInfo.cpp
    M llvm/test/CodeGen/AArch64/sve-ptest-removal-cmpeq.ll
    M llvm/test/CodeGen/AArch64/sve-ptest-removal-cmpeq.mir
    M llvm/test/CodeGen/AArch64/sve-ptest-removal-cmpge.ll
    M llvm/test/CodeGen/AArch64/sve-ptest-removal-cmpgt.ll
    M llvm/test/CodeGen/AArch64/sve-ptest-removal-cmphi.ll
    M llvm/test/CodeGen/AArch64/sve-ptest-removal-cmphs.ll
    M llvm/test/CodeGen/AArch64/sve-ptest-removal-cmple.ll
    M llvm/test/CodeGen/AArch64/sve-ptest-removal-cmplo.ll
    M llvm/test/CodeGen/AArch64/sve-ptest-removal-cmpls.ll
    M llvm/test/CodeGen/AArch64/sve-ptest-removal-cmplt.ll
    M llvm/test/CodeGen/AArch64/sve-ptest-removal-cmpne.ll
    M llvm/test/CodeGen/AArch64/sve-ptest-removal-match.ll

  Log Message:
  -----------
  [AArch64][SVE] Fix bad PTEST(PTRUE_ALL, PTEST_LIKE) optimization

AArch64InstrInfo::optimizePTestInstr attempts to remove a PTEST of a
predicate generating operation that identically sets flags (implictly).

When the mask is an all active of matching element size the PTEST is
currently removed. For while instructions this is correct since they
perform an implicit PTEST with an all active mask. However, for other
instructions such as compares the mask could be different.

This patch fixes this bug by only removing the PTEST if the same all
active mask is used by the predicating-generating instruction.

Reviewed By: bsmith

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




More information about the All-commits mailing list