[llvm-commits] [llvm] r100581 - in /llvm/trunk/lib: CodeGen/AsmPrinter/DwarfDebug.cpp CodeGen/VirtRegRewriter.cpp Target/SystemZ/SystemZRegisterInfo.cpp Target/X86/SSEDomainFix.cpp Target/X86/X86FastISel.cpp

John McCall rjmccall at apple.com
Tue Apr 6 16:56:30 PDT 2010

On Apr 6, 2010, at 4:50 PM, Duncan Sands wrote:
>> -          unsigned NumBytes = FltVal.getBitWidth() / 8; // 8 bits per byte.
>> +          int NumBytes = FltVal.getBitWidth() / 8; // 8 bits per byte.
> it doesn't make any sense for the bit width to be negative, so maybe
> getBitWidth() should be changed to return an unsigned value instead.

It does return an unsigned value.  The -Wsign-compare warnings are actually downstream of this;  changing the type of NumBytes just happened to be the nicest way of fixing them.

Dividing by 8 should be sufficient to suppress any unsigned-to-signed warnings for the variable initialization.


More information about the llvm-commits mailing list