[all-commits] [llvm/llvm-project] ad0085: [InstCombine] Eliminate casts to optimize ctlz ope...

datta via All-commits all-commits at lists.llvm.org
Wed Jun 23 08:19:27 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: ad0085d3381a28041244fe6847f6ac1ce8dd052e
      https://github.com/llvm/llvm-project/commit/ad0085d3381a28041244fe6847f6ac1ce8dd052e
  Author: Datta Nagraj <datta.nagraj at gmail.com>
  Date:   2021-06-23 (Wed, 23 Jun 2021)

  Changed paths:
    M llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp
    M llvm/test/Transforms/InstCombine/zext-ctlz-trunc-to-ctlz-add.ll

  Log Message:
  -----------
  [InstCombine] Eliminate casts to optimize ctlz operation

If a ctlz operation is performed on higher datatype and then
downcasted, then this can be optimized by doing a ctlz operation
on a lower datatype and adding the difference bitsize to the result
of ctlz to provide the same output:

https://alive2.llvm.org/ce/z/8uup9M

The original problem is shown in
https://llvm.org/PR50173

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




More information about the All-commits mailing list