As noted in https://github.com/halide/Halide/pull/6302,
we hilariously fail to match PAVG if we even as much
as look at it the wrong way.
In this particular case, the problem stems from the fact that
PAVG root (def) is a trunc, and leafs (uses) are zext's,
and InstCombine really loves to get rid of both of these,
for example replace them with a bit mask. So we may not have
said zext.
Instead of checking for that + type match,
i think we should rely on the actual active type,
as per the knownbits.
Is it worth adding a KnownBits get/countMaxActiveBits wrapper?