[all-commits] [llvm/llvm-project] 827f8a: Add opt with ctlz and shifts of power of 2 constan...

Sizov Nikita via All-commits all-commits at lists.llvm.org
Thu Dec 7 23:06:37 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 827f8a7ef6ddcade0700311793510e3b3e0829f0
      https://github.com/llvm/llvm-project/commit/827f8a7ef6ddcade0700311793510e3b3e0829f0
  Author: Sizov Nikita <s.nikita.v at gmail.com>
  Date:   2023-12-08 (Fri, 08 Dec 2023)

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

  Log Message:
  -----------
  Add opt with ctlz and shifts of power of 2 constants (#74175)

This patch does the following simplifications:
```
cttz(shl(C, X), 1) -> add(cttz(C, 1), X)
cttz(lshr exact(C, X), 1) -> sub(cttz(C, 1), X)
ctlz(lshr(C, X), 1) --> add(ctlz(C, 1), X)
ctlz(shl nuw (C, X), 1) --> sub(ctlz(C, 1), X)
```
Alive2: https://alive2.llvm.org/ce/z/9KHlKc
Closes #41333




More information about the All-commits mailing list