On Thu, Feb 18, 2021 at 11:22 AM Jakub Jelinek <ja...@redhat.com> wrote: > > On Thu, Feb 18, 2021 at 11:12:26AM +0100, Richard Biener via Gcc-patches > wrote: > > On Thu, Feb 18, 2021 at 12:35 AM Hans-Peter Nilsson via Gcc-patches > > <gcc-patches@gcc.gnu.org> wrote: > > > > > > If we're not going to eliminate the clz, it's better for the > > > comparison to use that result than its input, so we don't > > > extend the lifetime of the input. Also, an additional use > > > of the result is more likely cheaper than a compare of the > > > input, in particular considering that the clz may have made > > > available a non-zero condition matching the original use. > > > > Of course the non-zero compare can execute concurrently > > with the clz if we use the input which can result in faster > > operation. It's one of the many cases where local folding > > doesn't tell us enough. One of the usual issues with > > single_use checks is that the IL is not fully DCEd while > > we fold it and thus dead uses can make sth !single_use > > even though it really is single_use. > > And on the other side, the IL might not be fully CSEd yet and > so we can see single use, but after SCCVN it wouldn't be single use.
Yes, the issue is definitely complex. The IL before SCCVN can also be not fully DCEd and so VN could CSE an expression for one that is dead (and now becomes live). Richard. > Jakub >