[llvm] [Metadata] Make range boundary variables unsigned (NFC) (PR #99338)

via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 17 08:18:25 PDT 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-llvm-ir

Author: AtariDreams (AtariDreams)

<details>
<summary>Changes</summary>

They should be unsigned because the source and target value are too.

---
Full diff: https://github.com/llvm/llvm-project/pull/99338.diff


1 Files Affected:

- (modified) llvm/lib/IR/Metadata.cpp (+5-5) 


``````````diff
diff --git a/llvm/lib/IR/Metadata.cpp b/llvm/lib/IR/Metadata.cpp
index 3aec7140510a6..ae5f5de142328 100644
--- a/llvm/lib/IR/Metadata.cpp
+++ b/llvm/lib/IR/Metadata.cpp
@@ -1287,12 +1287,12 @@ MDNode *MDNode::getMostGenericRange(MDNode *A, MDNode *B) {
     return A;
 
   // First, walk both lists in order of the lower boundary of each interval.
-  // At each step, try to merge the new interval to the last one we adedd.
+  // At each step, try to merge the new interval to the last one we added.
   SmallVector<ConstantInt *, 4> EndPoints;
-  int AI = 0;
-  int BI = 0;
-  int AN = A->getNumOperands() / 2;
-  int BN = B->getNumOperands() / 2;
+  unsigned AI = 0;
+  unsigned BI = 0;
+  unsigned AN = A->getNumOperands() / 2;
+  unsigned BN = B->getNumOperands() / 2;
   while (AI < AN && BI < BN) {
     ConstantInt *ALow = mdconst::extract<ConstantInt>(A->getOperand(2 * AI));
     ConstantInt *BLow = mdconst::extract<ConstantInt>(B->getOperand(2 * BI));

``````````

</details>


https://github.com/llvm/llvm-project/pull/99338


More information about the llvm-commits mailing list