[llvm] [llvm] Construct SmallVector with ArrayRef (NFC) (PR #136063)
via llvm-commits
llvm-commits at lists.llvm.org
Wed Apr 16 17:24:57 PDT 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-llvm-ir
Author: Kazu Hirata (kazutakahirata)
<details>
<summary>Changes</summary>
---
Full diff: https://github.com/llvm/llvm-project/pull/136063.diff
3 Files Affected:
- (modified) llvm/lib/IR/IRBuilder.cpp (+4-9)
- (modified) llvm/tools/llvm-reduce/deltas/ReduceOperandsToArgs.cpp (+1-2)
- (modified) llvm/tools/lto/lto.cpp (+1-2)
``````````diff
diff --git a/llvm/lib/IR/IRBuilder.cpp b/llvm/lib/IR/IRBuilder.cpp
index e5a2f08c393c9..a195945c9cadb 100644
--- a/llvm/lib/IR/IRBuilder.cpp
+++ b/llvm/lib/IR/IRBuilder.cpp
@@ -748,18 +748,15 @@ getStatepointBundles(std::optional<ArrayRef<T1>> TransitionArgs,
ArrayRef<T3> GCArgs) {
std::vector<OperandBundleDef> Rval;
if (DeoptArgs) {
- SmallVector<Value*, 16> DeoptValues;
- llvm::append_range(DeoptValues, *DeoptArgs);
+ SmallVector<Value *, 16> DeoptValues(*DeoptArgs);
Rval.emplace_back("deopt", DeoptValues);
}
if (TransitionArgs) {
- SmallVector<Value*, 16> TransitionValues;
- llvm::append_range(TransitionValues, *TransitionArgs);
+ SmallVector<Value *, 16> TransitionValues(*TransitionArgs);
Rval.emplace_back("gc-transition", TransitionValues);
}
if (GCArgs.size()) {
- SmallVector<Value*, 16> LiveValues;
- llvm::append_range(LiveValues, GCArgs);
+ SmallVector<Value *, 16> LiveValues(GCArgs);
Rval.emplace_back("gc-live", LiveValues);
}
return Rval;
@@ -1091,9 +1088,7 @@ CallInst *IRBuilderBase::CreateConstrainedFPCall(
Function *Callee, ArrayRef<Value *> Args, const Twine &Name,
std::optional<RoundingMode> Rounding,
std::optional<fp::ExceptionBehavior> Except) {
- llvm::SmallVector<Value *, 6> UseArgs;
-
- append_range(UseArgs, Args);
+ llvm::SmallVector<Value *, 6> UseArgs(Args);
if (Intrinsic::hasConstrainedFPRoundingModeOperand(Callee->getIntrinsicID()))
UseArgs.push_back(getConstrainedFPRounding(Rounding));
diff --git a/llvm/tools/llvm-reduce/deltas/ReduceOperandsToArgs.cpp b/llvm/tools/llvm-reduce/deltas/ReduceOperandsToArgs.cpp
index 3f877b525549f..cb27d5473fd73 100644
--- a/llvm/tools/llvm-reduce/deltas/ReduceOperandsToArgs.cpp
+++ b/llvm/tools/llvm-reduce/deltas/ReduceOperandsToArgs.cpp
@@ -129,8 +129,7 @@ static void substituteOperandWithArgument(Function *OldF,
UniqueValues.insert(Op->get());
// Determine the new function's signature.
- SmallVector<Type *> NewArgTypes;
- llvm::append_range(NewArgTypes, OldF->getFunctionType()->params());
+ SmallVector<Type *> NewArgTypes(OldF->getFunctionType()->params());
size_t ArgOffset = NewArgTypes.size();
for (Value *V : UniqueValues)
NewArgTypes.push_back(V->getType());
diff --git a/llvm/tools/lto/lto.cpp b/llvm/tools/lto/lto.cpp
index 29219c9114522..bb64d42ccced1 100644
--- a/llvm/tools/lto/lto.cpp
+++ b/llvm/tools/lto/lto.cpp
@@ -496,8 +496,7 @@ void lto_codegen_debug_options_array(lto_code_gen_t cg,
const char *const *options, int number) {
assert(optionParsingState != OptParsingState::Early &&
"early option processing already happened");
- SmallVector<StringRef, 4> Options;
- llvm::append_range(Options, ArrayRef(options, number));
+ SmallVector<StringRef, 4> Options(ArrayRef(options, number));
unwrap(cg)->setCodeGenDebugOptions(ArrayRef(Options));
}
``````````
</details>
https://github.com/llvm/llvm-project/pull/136063
More information about the llvm-commits
mailing list