[llvm] a3cc9d1 - [MergeICmps] Fix -Wsign-compare and typos (NFC)

Jie Fu via llvm-commits llvm-commits at lists.llvm.org
Wed May 24 07:24:33 PDT 2023


Author: Jie Fu
Date: 2023-05-24T22:23:06+08:00
New Revision: a3cc9d19b574636821e974365deb0e05f7b7a857

URL: https://github.com/llvm/llvm-project/commit/a3cc9d19b574636821e974365deb0e05f7b7a857
DIFF: https://github.com/llvm/llvm-project/commit/a3cc9d19b574636821e974365deb0e05f7b7a857.diff

LOG: [MergeICmps] Fix -Wsign-compare and typos (NFC)

/data/llvm-project/llvm/lib/Transforms/Scalar/MergeICmps.cpp:623:21: error: comparison of integers of different signs: 'int' and 'size_t' (aka 'unsigne
d long') [-Werror,-Wsign-compare]
  for (int i = 0; i < Comparisons.size(); i++) {
                  ~ ^ ~~~~~~~~~~~~~~~~~~
1 error generated.

Added: 
    

Modified: 
    llvm/lib/Transforms/Scalar/MergeICmps.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/Scalar/MergeICmps.cpp b/llvm/lib/Transforms/Scalar/MergeICmps.cpp
index e3bf0008fc22..84fbbaad7a2f 100644
--- a/llvm/lib/Transforms/Scalar/MergeICmps.cpp
+++ b/llvm/lib/Transforms/Scalar/MergeICmps.cpp
@@ -616,14 +616,14 @@ class MergedBlockName {
 } // namespace
 
 // Check whether the current comparisons is the last comparisons.
-// Only the last comparisons chain include the last link (unconditionla jmp).
-// Due to reordering of contiguous comparison blocks, the unconditionla
+// Only the last comparisons chain include the last link (unconditional jmp).
+// Due to reordering of contiguous comparison blocks, the unconditional
 // comparison of a chain maybe not placed at the end of the array comparisons.
 static bool isLastLinkComparison(ArrayRef<BCECmpBlock> Comparisons) {
-  for (int i = 0; i < Comparisons.size(); i++) {
+  for (unsigned i = 0; i < Comparisons.size(); i++) {
     BasicBlock *const BB = Comparisons[i].BB;
     auto *const BranchI = cast<BranchInst>(BB->getTerminator());
-    // Only the last comparisons chain include the unconditionla jmp
+    // Only the last comparisons chain include the unconditional jmp
     if (BranchI->isUnconditional())
       return true;
   }


        


More information about the llvm-commits mailing list