[PATCH] D103788: [InstCombine] Eliminate casts to optimize ctlz operation

Datta Nagraj via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 10 22:00:59 PDT 2021


datta.nagraj added a comment.

In D103788#2811068 <https://reviews.llvm.org/D103788#2811068>, @spatel wrote:

> In D103788#2810814 <https://reviews.llvm.org/D103788#2810814>, @datta.nagraj wrote:
>
>> In D103788#2810722 <https://reviews.llvm.org/D103788#2810722>, @lebedev.ri wrote:
>>
>>> If we look at the sequence with `trunc`, then preconditions are different.
>>> I'm not sure if we have *some* problematic combination of src bitwidth and bitwidth increase,
>>> but the hard cut-off that is currently there is not correct.
>
> It seems like we could go wrong if the narrow (destination) type can't hold at least the bitwidth of the wide type -- that's what we saw in the Alive2 example of the transform without the trunc -- but I haven't come up with an example where it fails when we have the trunc:
> https://alive2.llvm.org/ce/z/89_wJb
>
>> I am currently not sure of what to do here Sir, also I have no clue as to why some unit tests are failing, because they don't even contain trunc inst, and don't even hit my changes.
>
> I don't understand this comment. What is failing?

The build had failed with that last commit, it might have been due to some other commit in main. The build is passing now after I did rebase.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D103788/new/

https://reviews.llvm.org/D103788



More information about the llvm-commits mailing list