[all-commits] [llvm/llvm-project] 80b897: [InstCombine] ctpop(X) ^ ctpop(Y) & 1 --> ctpop(X^...

Dávid Bolvanský via All-commits all-commits at lists.llvm.org
Tue May 4 04:16:53 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 80b897e21bf0ac56b04d415cf9bf671f81a84416
      https://github.com/llvm/llvm-project/commit/80b897e21bf0ac56b04d415cf9bf671f81a84416
  Author: Dávid Bolvanský <david.bolvansky at gmail.com>
  Date:   2021-05-04 (Tue, 04 May 2021)

  Changed paths:
    M llvm/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp
    M llvm/test/Transforms/InstCombine/ctpop.ll

  Log Message:
  -----------
  [InstCombine] ctpop(X) ^ ctpop(Y) & 1 --> ctpop(X^Y) & 1 (PR50094)

Original pattern: (__builtin_parity(x) ^ __builtin_parity(y))

LLVM rewrites it as: (__builtin_popcount(x) ^ __builtin_popcount(y)) & 1

Optimized form:  __builtin_popcount(X^Y) & 1

Alive proof: https://alive2.llvm.org/ce/z/-GdWFr

Reviewed By: RKSimon

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




More information about the All-commits mailing list