Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 22, 2024

Conversation

AZero13
Copy link
Contributor

@AZero13 AZero13 commented Jul 17, 2024

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

They should be unsigned because the source and target value are too.
@llvmbot
Copy link
Member

llvmbot commented Jul 17, 2024

@llvm/pr-subscribers-llvm-ir

Author: AtariDreams (AtariDreams)

Changes

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 --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));

@AZero13
Copy link
Contributor Author

AZero13 commented Jul 22, 2024

@MaskRay @nikic Thoughts?

Copy link
Contributor

@nikic nikic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks reasonable.

@nikic nikic merged commit ca3d4df into llvm:main Jul 22, 2024
9 checks passed
@AZero13 AZero13 deleted the patch-2 branch July 22, 2024 15:02
yuxuanchen1997 pushed a commit that referenced this pull request Jul 25, 2024
They should be unsigned because the source and target value are too.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants