[llvm] 060a96a - [LLVM][IR] Fixed input arguments for Verifier getter
Shivam Gupta via llvm-commits
llvm-commits at lists.llvm.org
Sat Oct 2 20:21:07 PDT 2021
Author: Alfsonso Gregory
Date: 2021-10-03T08:09:30+05:30
New Revision: 060a96a7b5d57cc8a64f84a3d40a34d015089085
URL: https://github.com/llvm/llvm-project/commit/060a96a7b5d57cc8a64f84a3d40a34d015089085
DIFF: https://github.com/llvm/llvm-project/commit/060a96a7b5d57cc8a64f84a3d40a34d015089085.diff
LOG: [LLVM][IR] Fixed input arguments for Verifier getter
ParameterABIAttributes functions work with unsigned integers as the index, so having the getter be signed makes no sense. Additionally, for this reason, the loop vars that were signed were changed to unsigned too.
Reviewed By: jeroen.dobbelaere
Differential Revision: https://reviews.llvm.org/D110344
Added:
Modified:
llvm/lib/IR/Verifier.cpp
Removed:
################################################################################
diff --git a/llvm/lib/IR/Verifier.cpp b/llvm/lib/IR/Verifier.cpp
index b620c402a052..0f56d992bffe 100644
--- a/llvm/lib/IR/Verifier.cpp
+++ b/llvm/lib/IR/Verifier.cpp
@@ -3314,7 +3314,7 @@ static bool isTypeCongruent(Type *L, Type *R) {
return PL->getAddressSpace() == PR->getAddressSpace();
}
-static AttrBuilder getParameterABIAttributes(int I, AttributeList Attrs) {
+static AttrBuilder getParameterABIAttributes(unsigned I, AttributeList Attrs) {
static const Attribute::AttrKind ABIAttrs[] = {
Attribute::StructRet, Attribute::ByVal, Attribute::InAlloca,
Attribute::InReg, Attribute::StackAlignment, Attribute::SwiftSelf,
@@ -3382,12 +3382,12 @@ void Verifier::verifyMustTailCall(CallInst &CI) {
// - Only sret, byval, swiftself, and swiftasync ABI-impacting attributes
// are allowed in swifttailcc call
- for (int I = 0, E = CallerTy->getNumParams(); I != E; ++I) {
+ for (unsigned I = 0, E = CallerTy->getNumParams(); I != E; ++I) {
AttrBuilder ABIAttrs = getParameterABIAttributes(I, CallerAttrs);
SmallString<32> Context{CCName, StringRef(" musttail caller")};
verifyTailCCMustTailAttrs(ABIAttrs, Context);
}
- for (int I = 0, E = CalleeTy->getNumParams(); I != E; ++I) {
+ for (unsigned I = 0, E = CalleeTy->getNumParams(); I != E; ++I) {
AttrBuilder ABIAttrs = getParameterABIAttributes(I, CalleeAttrs);
SmallString<32> Context{CCName, StringRef(" musttail callee")};
verifyTailCCMustTailAttrs(ABIAttrs, Context);
@@ -3405,7 +3405,7 @@ void Verifier::verifyMustTailCall(CallInst &CI) {
Assert(CallerTy->getNumParams() == CalleeTy->getNumParams(),
"cannot guarantee tail call due to mismatched parameter counts",
&CI);
- for (int I = 0, E = CallerTy->getNumParams(); I != E; ++I) {
+ for (unsigned I = 0, E = CallerTy->getNumParams(); I != E; ++I) {
Assert(
isTypeCongruent(CallerTy->getParamType(I), CalleeTy->getParamType(I)),
"cannot guarantee tail call due to mismatched parameter types", &CI);
@@ -3414,7 +3414,7 @@ void Verifier::verifyMustTailCall(CallInst &CI) {
// - All ABI-impacting function attributes, such as sret, byval, inreg,
// returned, preallocated, and inalloca, must match.
- for (int I = 0, E = CallerTy->getNumParams(); I != E; ++I) {
+ for (unsigned I = 0, E = CallerTy->getNumParams(); I != E; ++I) {
AttrBuilder CallerABIAttrs = getParameterABIAttributes(I, CallerAttrs);
AttrBuilder CalleeABIAttrs = getParameterABIAttributes(I, CalleeAttrs);
Assert(CallerABIAttrs == CalleeABIAttrs,
More information about the llvm-commits
mailing list