[PATCH] D102792: Fix warning: comparison of integer expressions of different signedness

Luke Benes via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed May 19 11:46:13 PDT 2021


lbenes created this revision.
lbenes added a reviewer: pengfei.
lbenes added a project: LLVM.
Herald added subscribers: hiraditya, kristof.beyls.
lbenes requested review of this revision.
Herald added a subscriber: llvm-commits.

This patch resolves the Wsign-compare warning that I observed on armv7l and x86 with both gcc and clang.


https://reviews.llvm.org/D102792

Files:
  llvm/lib/Target/X86/X86TileConfig.cpp


Index: llvm/lib/Target/X86/X86TileConfig.cpp
===================================================================
--- llvm/lib/Target/X86/X86TileConfig.cpp
+++ llvm/lib/Target/X86/X86TileConfig.cpp
@@ -176,7 +176,7 @@
             SubIdx = 0;
           auto Iter = DefMI.getIterator();
           if (&MBB == &MF.front() &&
-              std::distance(MBB.instr_begin(), Iter) < ConstPos)
+              (unsigned)std::distance(MBB.instr_begin(), Iter) < ConstPos)
             Iter = ConstMI->getIterator();
           NewMI = addFrameReference(
                       BuildMI(MBB, ++Iter, DL,


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D102792.346521.patch
Type: text/x-patch
Size: 596 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210519/6db55f9b/attachment.bin>


More information about the llvm-commits mailing list