[all-commits] [llvm/llvm-project] d4ec8e: [InstCombine] ctpop(X) + ctpop(Y) => ctpop(X | Y) ...

Dávid Bolvanský via All-commits all-commits at lists.llvm.org
Sat Apr 24 08:52:30 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: d4ec8ea19cb1c944f70b584b2bdb8a12ea875261
      https://github.com/llvm/llvm-project/commit/d4ec8ea19cb1c944f70b584b2bdb8a12ea875261
  Author: Dávid Bolvanský <david.bolvansky at gmail.com>
  Date:   2021-04-24 (Sat, 24 Apr 2021)

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

  Log Message:
  -----------
  [InstCombine] ctpop(X) + ctpop(Y) => ctpop(X | Y) if X and Y have no common bits (PR48999)

For example:

```
int src(unsigned int a, unsigned int b)
{
    return __builtin_popcount(a << 16) + __builtin_popcount(b >> 16);
}

int tgt(unsigned int a, unsigned int b)
{
    return __builtin_popcount((a << 16)  | (b >> 16));
}
```

Reviewed By: nikic

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




More information about the All-commits mailing list