[all-commits] [llvm/llvm-project] 72d141: [InstCombine] Add CTPOP -> CTTZ simplifications (P...

Simon Pilgrim via All-commits all-commits at lists.llvm.org
Mon Mar 23 04:05:06 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 72d1419bfba2a1c4d842ab57849a22d9260a1bb6
      https://github.com/llvm/llvm-project/commit/72d1419bfba2a1c4d842ab57849a22d9260a1bb6
  Author: Simon Pilgrim <llvm-dev at redking.me.uk>
  Date:   2020-03-23 (Mon, 23 Mar 2020)

  Changed paths:
    M llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
    M llvm/test/Transforms/InstCombine/ctpop-cttz.ll

  Log Message:
  -----------
  [InstCombine] Add CTPOP -> CTTZ simplifications (PR43513)

As detailed on PR43513, we can simplify:

ctpop(x | -x) -> bitwidth - cttz(x, false)
Alive2: http://volta.cs.utah.edu:8080/z/caw49X

ctpop(~x & (x - 1)) -> cttz(x, false)
Alive2: http://volta.cs.utah.edu:8080/z/5zfVrx

I've tweaked the initial test cases I added at rG2d712fb75584 to increase commutativity testing.

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




More information about the All-commits mailing list