Skip to content

[llvm] Construct SmallVector with ArrayRef (NFC) #136063

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 8 additions & 18 deletions llvm/lib/IR/IRBuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -747,21 +747,13 @@ getStatepointBundles(std::optional<ArrayRef<T1>> TransitionArgs,
std::optional<ArrayRef<T2>> DeoptArgs,
ArrayRef<T3> GCArgs) {
std::vector<OperandBundleDef> Rval;
if (DeoptArgs) {
SmallVector<Value*, 16> DeoptValues;
llvm::append_range(DeoptValues, *DeoptArgs);
Rval.emplace_back("deopt", DeoptValues);
}
if (TransitionArgs) {
SmallVector<Value*, 16> TransitionValues;
llvm::append_range(TransitionValues, *TransitionArgs);
Rval.emplace_back("gc-transition", TransitionValues);
}
if (GCArgs.size()) {
SmallVector<Value*, 16> LiveValues;
llvm::append_range(LiveValues, GCArgs);
Rval.emplace_back("gc-live", LiveValues);
}
if (DeoptArgs)
Rval.emplace_back("deopt", SmallVector<Value *, 16>(*DeoptArgs));
if (TransitionArgs)
Rval.emplace_back("gc-transition",
SmallVector<Value *, 16>(*TransitionArgs));
if (GCArgs.size())
Rval.emplace_back("gc-live", SmallVector<Value *, 16>(GCArgs));
return Rval;
}

Expand Down Expand Up @@ -1091,9 +1083,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));
Expand Down
3 changes: 1 addition & 2 deletions llvm/tools/llvm-reduce/deltas/ReduceOperandsToArgs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down
3 changes: 1 addition & 2 deletions llvm/tools/lto/lto.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}

Expand Down
Loading