[llvm] [NFC][LLVM][IRBuilder] Use `map_to_vector` to build vector of types (PR #195459)
via llvm-commits
llvm-commits at lists.llvm.org
Sat May 2 09:12:45 PDT 2026
llvmorg-github-actions[bot] wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-llvm-ir
Author: Rahul Joshi (jurahul)
<details>
<summary>Changes</summary>
---
Full diff: https://github.com/llvm/llvm-project/pull/195459.diff
1 Files Affected:
- (modified) llvm/lib/IR/IRBuilder.cpp (+2-6)
``````````diff
diff --git a/llvm/lib/IR/IRBuilder.cpp b/llvm/lib/IR/IRBuilder.cpp
index 8b8f8e68ee2b9..b322d5e0d0650 100644
--- a/llvm/lib/IR/IRBuilder.cpp
+++ b/llvm/lib/IR/IRBuilder.cpp
@@ -13,6 +13,7 @@
#include "llvm/IR/IRBuilder.h"
#include "llvm/ADT/ArrayRef.h"
+#include "llvm/ADT/SmallVectorExtras.h"
#include "llvm/IR/Constant.h"
#include "llvm/IR/Constants.h"
#include "llvm/IR/DerivedTypes.h"
@@ -941,12 +942,7 @@ CallInst *IRBuilderBase::CreateIntrinsic(Type *RetTy, Intrinsic::ID ID,
FMFSource FMFSource,
const Twine &Name) {
Module *M = BB->getModule();
-
- SmallVector<Type *> ArgTys;
- ArgTys.reserve(Args.size());
- for (auto &I : Args)
- ArgTys.push_back(I->getType());
-
+ SmallVector<Type *> ArgTys = llvm::map_to_vector(Args, &Value::getType);
Function *Fn = Intrinsic::getOrInsertDeclaration(M, ID, RetTy, ArgTys);
return createCallHelper(Fn, Args, Name, FMFSource);
}
``````````
</details>
https://github.com/llvm/llvm-project/pull/195459
More information about the llvm-commits
mailing list