[llvm] [llvm] Construct SmallVector with ArrayRef (NFC) (PR #102799)

Kazu Hirata via llvm-commits llvm-commits at lists.llvm.org
Sun Aug 11 00:35:16 PDT 2024


https://github.com/kazutakahirata created https://github.com/llvm/llvm-project/pull/102799

None

>From a92adbd9a6fea9e1835967bf67246e731dc2203a Mon Sep 17 00:00:00 2001
From: Kazu Hirata <kazu at google.com>
Date: Sun, 11 Aug 2024 00:28:41 -0700
Subject: [PATCH] [llvm] Construct SmallVector with ArrayRef (NFC)

---
 llvm/lib/TableGen/Record.cpp                | 2 +-
 llvm/lib/Transforms/IPO/ExpandVariadics.cpp | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/llvm/lib/TableGen/Record.cpp b/llvm/lib/TableGen/Record.cpp
index c2883d2cc158cd..bcecee8e550c88 100644
--- a/llvm/lib/TableGen/Record.cpp
+++ b/llvm/lib/TableGen/Record.cpp
@@ -292,7 +292,7 @@ bool RecordRecTy::typeIsA(const RecTy *RHS) const {
 
 static RecordRecTy *resolveRecordTypes(RecordRecTy *T1, RecordRecTy *T2) {
   SmallVector<Record *, 4> CommonSuperClasses;
-  SmallVector<Record *, 4> Stack(T1->classes_begin(), T1->classes_end());
+  SmallVector<Record *, 4> Stack(T1->getClasses());
 
   while (!Stack.empty()) {
     Record *R = Stack.pop_back_val();
diff --git a/llvm/lib/Transforms/IPO/ExpandVariadics.cpp b/llvm/lib/Transforms/IPO/ExpandVariadics.cpp
index 3a1f690bf03907..49bfec297bc173 100644
--- a/llvm/lib/Transforms/IPO/ExpandVariadics.cpp
+++ b/llvm/lib/Transforms/IPO/ExpandVariadics.cpp
@@ -238,7 +238,7 @@ class ExpandVariadics : public ModulePass {
 
   FunctionType *inlinableVariadicFunctionType(Module &M, FunctionType *FTy) {
     // The type of "FTy" with the ... removed and a va_list appended
-    SmallVector<Type *> ArgTypes(FTy->param_begin(), FTy->param_end());
+    SmallVector<Type *> ArgTypes(FTy->params());
     ArgTypes.push_back(ABI->vaListParameterType(M));
     return FunctionType::get(FTy->getReturnType(), ArgTypes,
                              /*IsVarArgs=*/false);
@@ -538,7 +538,7 @@ ExpandVariadics::deriveFixedArityReplacement(Module &M, IRBuilder<> &Builder,
   const bool FunctionIsDefinition = !F.isDeclaration();
 
   FunctionType *FTy = F.getFunctionType();
-  SmallVector<Type *> ArgTypes(FTy->param_begin(), FTy->param_end());
+  SmallVector<Type *> ArgTypes(FTy->params());
   ArgTypes.push_back(ABI->vaListParameterType(M));
 
   FunctionType *NFTy = inlinableVariadicFunctionType(M, FTy);



More information about the llvm-commits mailing list