[LLVMdev] scalar-evolution + indvars fail to get the loop trip count?
Eli Friedman
eli.friedman at gmail.com
Tue Dec 9 10:18:03 PST 2008
On Tue, Dec 9, 2008 at 1:43 AM, Sheng Zhou <zhousheng at autoesl.com> wrote:
>> Yes, that code path will fail for this example.
>>
> Why not improve this? We can change it into :
>
> APInt ExitVal = (End + A).sdiv(A);
>
> Surely we should take care of the range of this expression, maybe need extend the bitwidth of (End+A)
That's not quite correct for cases where End is positive. I'm pretty
sure the correct way to deal with this is that if A is less than zero,
it should negate both End and A.
-Eli
More information about the llvm-dev
mailing list