Skip to content

Commit ee17ca7

Browse files
[llvm] Construct SmallVector with ArrayRef (NFC) (#136063)
1 parent de528d6 commit ee17ca7

File tree

3 files changed

+10
-22
lines changed

3 files changed

+10
-22
lines changed

llvm/lib/IR/IRBuilder.cpp

Lines changed: 8 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -747,21 +747,13 @@ getStatepointBundles(std::optional<ArrayRef<T1>> TransitionArgs,
747747
std::optional<ArrayRef<T2>> DeoptArgs,
748748
ArrayRef<T3> GCArgs) {
749749
std::vector<OperandBundleDef> Rval;
750-
if (DeoptArgs) {
751-
SmallVector<Value*, 16> DeoptValues;
752-
llvm::append_range(DeoptValues, *DeoptArgs);
753-
Rval.emplace_back("deopt", DeoptValues);
754-
}
755-
if (TransitionArgs) {
756-
SmallVector<Value*, 16> TransitionValues;
757-
llvm::append_range(TransitionValues, *TransitionArgs);
758-
Rval.emplace_back("gc-transition", TransitionValues);
759-
}
760-
if (GCArgs.size()) {
761-
SmallVector<Value*, 16> LiveValues;
762-
llvm::append_range(LiveValues, GCArgs);
763-
Rval.emplace_back("gc-live", LiveValues);
764-
}
750+
if (DeoptArgs)
751+
Rval.emplace_back("deopt", SmallVector<Value *, 16>(*DeoptArgs));
752+
if (TransitionArgs)
753+
Rval.emplace_back("gc-transition",
754+
SmallVector<Value *, 16>(*TransitionArgs));
755+
if (GCArgs.size())
756+
Rval.emplace_back("gc-live", SmallVector<Value *, 16>(GCArgs));
765757
return Rval;
766758
}
767759

@@ -1091,9 +1083,7 @@ CallInst *IRBuilderBase::CreateConstrainedFPCall(
10911083
Function *Callee, ArrayRef<Value *> Args, const Twine &Name,
10921084
std::optional<RoundingMode> Rounding,
10931085
std::optional<fp::ExceptionBehavior> Except) {
1094-
llvm::SmallVector<Value *, 6> UseArgs;
1095-
1096-
append_range(UseArgs, Args);
1086+
llvm::SmallVector<Value *, 6> UseArgs(Args);
10971087

10981088
if (Intrinsic::hasConstrainedFPRoundingModeOperand(Callee->getIntrinsicID()))
10991089
UseArgs.push_back(getConstrainedFPRounding(Rounding));

llvm/tools/llvm-reduce/deltas/ReduceOperandsToArgs.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,8 +129,7 @@ static void substituteOperandWithArgument(Function *OldF,
129129
UniqueValues.insert(Op->get());
130130

131131
// Determine the new function's signature.
132-
SmallVector<Type *> NewArgTypes;
133-
llvm::append_range(NewArgTypes, OldF->getFunctionType()->params());
132+
SmallVector<Type *> NewArgTypes(OldF->getFunctionType()->params());
134133
size_t ArgOffset = NewArgTypes.size();
135134
for (Value *V : UniqueValues)
136135
NewArgTypes.push_back(V->getType());

llvm/tools/lto/lto.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -496,8 +496,7 @@ void lto_codegen_debug_options_array(lto_code_gen_t cg,
496496
const char *const *options, int number) {
497497
assert(optionParsingState != OptParsingState::Early &&
498498
"early option processing already happened");
499-
SmallVector<StringRef, 4> Options;
500-
llvm::append_range(Options, ArrayRef(options, number));
499+
SmallVector<StringRef, 4> Options(ArrayRef(options, number));
501500
unwrap(cg)->setCodeGenDebugOptions(ArrayRef(Options));
502501
}
503502

0 commit comments

Comments
 (0)