[llvm-commits] Fix for PR1798 (ScalarEvolution)

Nick Lewycky nicholas at mxc.ca
Sun Feb 10 16:32:36 PST 2008


Wojciech Matyjewicz wrote:
> Nick Lewycky wrote:
>> Just one question,
>>
>> +  const IntegerType *ExTy = IntegerType::get(std::max(DividendBits, 32U));
>>
>> why the max of DividendBits and 32? If for whatever reason we think we 
>> need only 16 bits for the computation, why expand it to 32?
> 
> We compute the divisor of the BC formula using 32-bit arithmetic. Hence,
> this is the lower bound for the bitwitdh of the division, and the
> dividend as well.

That makes sense.

> After your question, I have realized that 32 bits for the divisor may be
> too much... Using "only" 16 bits would allow us to handle AddRecs up to
> length 8. If you agree 16 is a safe bitwidth, I'll change it. However,
> the maximum operation you ask about will still be necessary.

Optimally, we'd use APInt and get the right length up front, but there's 
no need for that to hold up this patch.

Nick



More information about the llvm-commits mailing list