[llvm-dev] [PATCH 1/2] AMDGPU/SIInsertWaitcnts: Fix comparison of integers of different signs

Mauro Rossi via llvm-dev llvm-dev at lists.llvm.org
Sun Jun 10 06:34:12 PDT 2018


Fixes the following building error:

external/llvm/lib/Target/AMDGPU/SIInsertWaitcnts.cpp:1903:61:
error: comparison of integers of different signs:
'typename iterator_traits<__wrap_iter<MachineBasicBlock **> >::difference_type'
(aka 'int') and 'unsigned int' [-Werror,-Wsign-compare]
                      BlockWaitcntProcessedSet.end(), &MBB) < Count)) {
                      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^ ~~~~~
1 error generated.

Fixes: 4f520606fc ("[AMDGPU] Do not only rely on BB number when finding bottom loop")
---
 lib/Target/AMDGPU/SIInsertWaitcnts.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/Target/AMDGPU/SIInsertWaitcnts.cpp b/lib/Target/AMDGPU/SIInsertWaitcnts.cpp
index fb24d528c33..c3c93cc85e2 100644
--- a/lib/Target/AMDGPU/SIInsertWaitcnts.cpp
+++ b/lib/Target/AMDGPU/SIInsertWaitcnts.cpp
@@ -1900,7 +1900,7 @@ bool SIInsertWaitcnts::runOnMachineFunction(MachineFunction &MF) {
       // If the loop has multiple back-edges, and so more than one "bottom"
       // basic block, we have to guarantee a re-walk over every blocks.
       if ((std::count(BlockWaitcntProcessedSet.begin(),
-                      BlockWaitcntProcessedSet.end(), &MBB) < Count)) {
+                      BlockWaitcntProcessedSet.end(), &MBB) < (int) Count)) {
         BlockWaitcntBracketsMap[&MBB]->setRevisitLoop(true);
         LLVM_DEBUG(dbgs() << "set-revisit1: Block"
                           << ContainingLoop->getHeader()->getNumber() << '\n';);
-- 
2.17.1



More information about the llvm-dev mailing list