[llvm] [InstCombine] Narrow the ctpop when upper bits are known zero (PR #196537)

Rutansh Suthar via llvm-commits llvm-commits at lists.llvm.org
Fri May 8 08:10:49 PDT 2026


RutanshS wrote:

> Do we not get any kind of ISD::AssertZext node when moving to DAG?

For test cases like func6 we don't get an ISD::AssertZext node because the argument is a 64 bit int passed into a 64 bit register, so SelectionDAGBuilder has no reason to emit an AssertZext.

The only reason we know that the upper bits are zero is because of the _builtin_unreachable() which translates to a llvm.assume. And because they are dropped before lowering to DAG, the backend loses this information.

https://github.com/llvm/llvm-project/pull/196537


More information about the llvm-commits mailing list