MDNode *MDBuilder::createBranchWeights(uint32_t TrueWeight,
uint32_t FalseWeight) {
- uint32_t Weights[] = {TrueWeight, FalseWeight};
- return createBranchWeights(Weights);
+ return createBranchWeights({TrueWeight, FalseWeight});
}
MDNode *MDBuilder::createBranchWeights(ArrayRef<uint32_t> Weights) {
}
MDNode *MDBuilder::createFunctionEntryCount(uint64_t Count) {
- SmallVector<Metadata *, 2> Vals(2);
- Vals[0] = createString("function_entry_count");
-
Type *Int64Ty = Type::getInt64Ty(Context);
- Vals[1] = createConstant(ConstantInt::get(Int64Ty, Count));
-
- return MDNode::get(Context, Vals);
+ return MDNode::get(Context,
+ {createString("function_entry_count"),
+ createConstant(ConstantInt::get(Int64Ty, Count))});
}
MDNode *MDBuilder::createRange(const APInt &Lo, const APInt &Hi) {
return nullptr;
// Return the range [Lo, Hi).
- Metadata *Range[2] = {createConstant(Lo), createConstant(Hi)};
- return MDNode::get(Context, Range);
+ return MDNode::get(Context, {createConstant(Lo), createConstant(Hi)});
}
MDNode *MDBuilder::createAnonymousAARoot(StringRef Name, MDNode *Extra) {
bool isConstant) {
if (isConstant) {
Constant *Flags = ConstantInt::get(Type::getInt64Ty(Context), 1);
- Metadata *Ops[3] = {createString(Name), Parent, createConstant(Flags)};
- return MDNode::get(Context, Ops);
- } else {
- Metadata *Ops[2] = {createString(Name), Parent};
- return MDNode::get(Context, Ops);
+ return MDNode::get(Context,
+ {createString(Name), Parent, createConstant(Flags)});
}
+ return MDNode::get(Context, {createString(Name), Parent});
}
MDNode *MDBuilder::createAliasScopeDomain(StringRef Name) {
}
MDNode *MDBuilder::createAliasScope(StringRef Name, MDNode *Domain) {
- Metadata *Ops[2] = {createString(Name), Domain};
- return MDNode::get(Context, Ops);
+ return MDNode::get(Context, {createString(Name), Domain});
}
/// \brief Return metadata for a tbaa.struct node with the given
MDNode *MDBuilder::createTBAAScalarTypeNode(StringRef Name, MDNode *Parent,
uint64_t Offset) {
ConstantInt *Off = ConstantInt::get(Type::getInt64Ty(Context), Offset);
- Metadata *Ops[3] = {createString(Name), Parent, createConstant(Off)};
- return MDNode::get(Context, Ops);
+ return MDNode::get(Context,
+ {createString(Name), Parent, createConstant(Off)});
}
/// \brief Return metadata for a TBAA tag node with the given
/// base type, access type and offset relative to the base type.
MDNode *MDBuilder::createTBAAStructTagNode(MDNode *BaseType, MDNode *AccessType,
uint64_t Offset, bool IsConstant) {
- Type *Int64 = Type::getInt64Ty(Context);
+ IntegerType *Int64 = Type::getInt64Ty(Context);
+ ConstantInt *Off = ConstantInt::get(Int64, Offset);
if (IsConstant) {
- Metadata *Ops[4] = {BaseType, AccessType,
- createConstant(ConstantInt::get(Int64, Offset)),
- createConstant(ConstantInt::get(Int64, 1))};
- return MDNode::get(Context, Ops);
- } else {
- Metadata *Ops[3] = {BaseType, AccessType,
- createConstant(ConstantInt::get(Int64, Offset))};
- return MDNode::get(Context, Ops);
+ return MDNode::get(Context, {BaseType, AccessType, createConstant(Off),
+ createConstant(ConstantInt::get(Int64, 1))});
}
+ return MDNode::get(Context, {BaseType, AccessType, createConstant(Off)});
}