[PATCH] Move transforms from InstCombine to InstSimplify
Duncan Sands
duncan.sands at gmail.com
Thu Jul 11 22:42:27 PDT 2013
Hi David,
> + } else {
> + // 'shl CI2, x' produces [CI2, CI2 << (Width-1)]
> + Lower = CI2Value;
> + Upper = CI2Value.shl(Width - 1) + 1;
>
>
> this one seems wrong to me. Consider for example CI2 (in binary) equal to
> 10001000
> Then Lower=10001000, Upper=00000001, but a left-shift by 1 of CI2 is
> 00010000 which is not in the range Lower .. Upper.
>
>
> Thanks, I've updated the patch so that we will set Lower to zero and Upper to
> CI2 << CLZ(CI2) which is conservative but, AFAIK, correct.
are you sure?
10110000
Lower = 0, Upper = 10110000, but shifting left by two gives 11000000 which is
out of the range.
Ciao, Duncan.
More information about the llvm-commits
mailing list