[all-commits] [llvm/llvm-project] 2f217c: [InstCombine] Canonicalize ((X & -X) - 1) --> ((X ...

Simon Pilgrim via All-commits all-commits at lists.llvm.org
Wed Aug 24 08:51:16 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 2f217c12142639900a0d25c5d9ce67142f7bd840
      https://github.com/llvm/llvm-project/commit/2f217c12142639900a0d25c5d9ce67142f7bd840
  Author: Simon Pilgrim <llvm-dev at redking.me.uk>
  Date:   2022-08-24 (Wed, 24 Aug 2022)

  Changed paths:
    M llvm/lib/Transforms/InstCombine/InstCombineAddSub.cpp
    M llvm/test/Transforms/InstCombine/add-mask-neg.ll
    M llvm/test/Transforms/InstCombine/ctpop-cttz.ll

  Log Message:
  -----------
  [InstCombine] Canonicalize ((X & -X) - 1) --> ((X - 1) & ~X) (PR51784)

Enables the ctpop((x & -x ) - 1) -> cttz(x, false) fold

Alive2: https://alive2.llvm.org/ce/z/EDk4h7 (((X & -X) - 1) --> (~X & (X - 1)) )

Alive2: https://alive2.llvm.org/ce/z/8Yr3XG (CTPOP -> CTTZ)

Fixes #51126

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




More information about the All-commits mailing list