[llvm] r228027 - Fixed signed/unsigned comparison warning.

Chandler Carruth chandlerc at google.com
Tue Feb 3 13:16:51 PST 2015

On Tue, Feb 3, 2015 at 1:10 PM, Chad Rosier <mcrosier at codeaurora.org> wrote:

> Hi Simon,
> MVT::getVectorNumElements() has an 'unsigned' return type.
> Would it make more sense to change NumElements to unsigned and fix the
> induction variables for those loops that compare NumElements, rather than
> using a cast in the assert?

I strongly prefer not to.

We are often doing subtraction and other things, and in fact using them
with values which can be -1. Using unsigned anywhere in this code is just

The nice thing about casting to an int is that UBSan can throw an error if
it is out-of-range.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150203/019e85fd/attachment.html>

More information about the llvm-commits mailing list