On 2/18/26 13:07, Théo Papadopoulo wrote:
On 2/18/26 11:33 AM, Victor Do Nascimento wrote:
   - Finally, a simplification is made.  Before, we had the check:

   if ((vf.is_constant () && pow2p_hwi (new_alignment.to_constant ()))
        || (!vf.is_constant () && pow2p_hwi (align_factor_c)))

   Given that we have `new_alignment = vf * align_factor_c', I do not
   believe anything can be derived from `new_alignment' that is now known
   already in `align_factor_c '.  That is, a power of 2 has only one
   prime factor: 2.  If `align_factor_c' is not itself a power of 2,
   the multiplication by `vf' cannot correct that, such that the check
   for `new_alignment' seems redundant.  The predicate can thus
   simplified to `if (pow2p_hwi (align_factor_c))'.  The seems sound to
   me, should my logic be correct.

This simplification is certainly wrong if vf is constant and not a power of 2 and if align_factor_c is a power of 2.... if that can happen.

Theo.

Thanks Theo.  Yes, you're right.

Given the patch is to fix non power-of-2 `align_factor_c' cases, I
reasoned only about cases with that as a starting point, neglecting to
think about other hypothetical cases where the `align_factor_c' value
is fine to begin with and what "messes up" the power-of-2 criterion is
the `vf' value.

Thanks for bringing that to my attention...

Onto v3 we go.

Many thanks,
Victor

Reply via email to