Skip to content

Commit

Permalink
Merge branch 'vc/llvm16' into vc/llvm16_bump
Browse files Browse the repository at this point in the history
  • Loading branch information
gbaraldi authored Oct 17, 2023
2 parents 3c789a4 + 0e6868f commit 213c89b
Show file tree
Hide file tree
Showing 9 changed files with 57 additions and 57 deletions.
4 changes: 2 additions & 2 deletions src/APInt-C.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ const unsigned int host_char_bit = 8;
/* TODO: this memcpy assumes little-endian,
* for big-endian, need to align the copy to the other end */ \
memcpy(data_a64, p##s, RoundUpToAlignment(numbits, host_char_bit) / host_char_bit); \
s = APInt(numbits, makeArrayRef(data_a64, nbytes / sizeof(integerPart))); \
s = APInt(numbits, ArrayRef<uint64_t>(data_a64, nbytes / sizeof(integerPart))); \
} \
else { \
s = APInt(numbits, makeArrayRef(p##s, numbits / integerPartWidth)); \
s = APInt(numbits, ArrayRef<uint64_t>(p##s, numbits / integerPartWidth)); \
}

/* assign to "integerPart *pr" from "APInt a" */
Expand Down
16 changes: 8 additions & 8 deletions src/ccall.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -439,21 +439,21 @@ static Value *llvm_type_rewrite(
Value *from;
Value *to;
const DataLayout &DL = ctx.builder.GetInsertBlock()->getModule()->getDataLayout();
unsigned align = std::max(DL.getPrefTypeAlignment(target_type), DL.getPrefTypeAlignment(from_type));
Align align = std::max(DL.getPrefTypeAlign(target_type), DL.getPrefTypeAlign(from_type));
if (DL.getTypeAllocSize(target_type) >= DL.getTypeAllocSize(from_type)) {
to = emit_static_alloca(ctx, target_type);
setName(ctx.emission_context, to, "type_rewrite_buffer");
cast<AllocaInst>(to)->setAlignment(Align(align));
cast<AllocaInst>(to)->setAlignment(align);
from = emit_bitcast(ctx, to, from_type->getPointerTo());
}
else {
from = emit_static_alloca(ctx, from_type);
setName(ctx.emission_context, from, "type_rewrite_buffer");
cast<AllocaInst>(from)->setAlignment(Align(align));
cast<AllocaInst>(from)->setAlignment(align);
to = emit_bitcast(ctx, from, target_type->getPointerTo());
}
ctx.builder.CreateAlignedStore(v, from, Align(align));
auto pun = ctx.builder.CreateAlignedLoad(target_type, to, Align(align));
ctx.builder.CreateAlignedStore(v, from, align);
auto pun = ctx.builder.CreateAlignedLoad(target_type, to, align);
setName(ctx.emission_context, pun, "type_rewrite");
return pun;
}
Expand All @@ -472,7 +472,7 @@ static Value *runtime_apply_type_env(jl_codectx_t &ctx, jl_value_t *ty)
ctx.spvals_ptr,
ConstantInt::get(ctx.types().T_size, sizeof(jl_svec_t) / sizeof(jl_value_t*)))
};
auto call = ctx.builder.CreateCall(prepare_call(jlapplytype_func), makeArrayRef(args));
auto call = ctx.builder.CreateCall(prepare_call(jlapplytype_func), ArrayRef<Value*>(args));
addRetAttr(call, Attribute::getWithAlignment(ctx.builder.getContext(), Align(16)));
return call;
}
Expand Down Expand Up @@ -1055,7 +1055,7 @@ class function_sig_t {
FunctionType *functype(LLVMContext &ctxt) const {
assert(err_msg.empty());
if (nreqargs > 0)
return FunctionType::get(sret ? getVoidTy(ctxt) : prt, makeArrayRef(fargt_sig).slice(0, nreqargs), true);
return FunctionType::get(sret ? getVoidTy(ctxt) : prt, ArrayRef<Type*>(fargt_sig).slice(0, nreqargs), true);
else
return FunctionType::get(sret ? getVoidTy(ctxt) : prt, fargt_sig, false);
}
Expand Down Expand Up @@ -1903,7 +1903,7 @@ static jl_cgval_t emit_ccall(jl_codectx_t &ctx, jl_value_t **args, size_t nargs)
decay_derived(ctx, data_pointer(ctx, val)),
T_pint8_derived)
};
Value *ret = ctx.builder.CreateCall(prepare_call(jl_object_id__func), makeArrayRef(args));
Value *ret = ctx.builder.CreateCall(prepare_call(jl_object_id__func), ArrayRef<Value*>(args));
setName(ctx.emission_context, ret, "object_id");
JL_GC_POP();
return mark_or_box_ccall_result(ctx, ret, retboxed, rt, unionall, static_rt);
Expand Down
30 changes: 15 additions & 15 deletions src/cgutils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -825,7 +825,7 @@ static Type *_julia_struct_to_llvm(jl_codegen_params_t *ctx, LLVMContext &ctxt,
// unsigned remainder = fsz % al;
// while (remainder--)
// Elements.push_back(getInt8Ty(ctxt));
// lty = StructType::get(lty->getContext(), makeArrayRef(Elements));
// lty = StructType::get(lty->getContext(),ArrayRef<Type*>(Elements));
// }
if (isboxed) *isboxed = true;
return JuliaType::get_prjlvalue_ty(ctxt);
Expand Down Expand Up @@ -2389,11 +2389,11 @@ static bool emit_getfield_unknownidx(jl_codectx_t &ctx,
assert((cast<ArrayType>(strct.V->getType())->getElementType() == ctx.types().T_prjlvalue) == isboxed);
Value *idx = idx0();
unsigned i = 0;
Value *fld = ctx.builder.CreateExtractValue(strct.V, makeArrayRef(i));
Value *fld = ctx.builder.CreateExtractValue(strct.V, ArrayRef<unsigned>(i));
for (i = 1; i < nfields; i++) {
fld = ctx.builder.CreateSelect(
ctx.builder.CreateICmpEQ(idx, ConstantInt::get(idx->getType(), i)),
ctx.builder.CreateExtractValue(strct.V, makeArrayRef(i)),
ctx.builder.CreateExtractValue(strct.V, ArrayRef<unsigned>(i)),
fld);
}
setName(ctx.emission_context, fld, "getfield");
Expand Down Expand Up @@ -2639,7 +2639,7 @@ static jl_cgval_t emit_getfield_knownidx(jl_codectx_t &ctx, const jl_cgval_t &st
unsigned i = 0;
for (; i < fsz / align; i++) {
unsigned fld = st_idx + i;
Value *fldv = ctx.builder.CreateExtractValue(obj, makeArrayRef(fld));
Value *fldv = ctx.builder.CreateExtractValue(obj, ArrayRef<unsigned>(fld));
Value *fldp = ctx.builder.CreateConstInBoundsGEP1_32(ET, lv, i);
ctx.builder.CreateAlignedStore(fldv, fldp, Align(align));
}
Expand All @@ -2648,14 +2648,14 @@ static jl_cgval_t emit_getfield_knownidx(jl_codectx_t &ctx, const jl_cgval_t &st
Value *staddr = ctx.builder.CreateConstInBoundsGEP1_32(ET, lv, i);
staddr = ctx.builder.CreateBitCast(staddr, getInt8PtrTy(ctx.builder.getContext()));
for (; i < ptindex - st_idx; i++) {
Value *fldv = ctx.builder.CreateExtractValue(obj, makeArrayRef(st_idx + i));
Value *fldv = ctx.builder.CreateExtractValue(obj, ArrayRef<unsigned>(st_idx + i));
Value *fldp = ctx.builder.CreateConstInBoundsGEP1_32(getInt8Ty(ctx.builder.getContext()), staddr, i);
ctx.builder.CreateAlignedStore(fldv, fldp, Align(1));
}
}
setNameWithField(ctx.emission_context, lv, get_objname, jt, idx, Twine());
}
Value *tindex0 = ctx.builder.CreateExtractValue(obj, makeArrayRef(ptindex));
Value *tindex0 = ctx.builder.CreateExtractValue(obj, ArrayRef<unsigned>(ptindex));
Value *tindex = ctx.builder.CreateNUWAdd(ConstantInt::get(getInt8Ty(ctx.builder.getContext()), 1), tindex0);
setNameWithField(ctx.emission_context, tindex, get_objname, jt, idx, Twine(".tindex"));
return mark_julia_slot(lv, jfty, tindex, ctx.tbaa().tbaa_stack);
Expand All @@ -2668,7 +2668,7 @@ static jl_cgval_t emit_getfield_knownidx(jl_codectx_t &ctx, const jl_cgval_t &st
st_idx = convert_struct_offset(ctx, T, byte_offset);
else
llvm_unreachable("encountered incompatible type for a struct");
fldv = ctx.builder.CreateExtractValue(obj, makeArrayRef(st_idx));
fldv = ctx.builder.CreateExtractValue(obj, ArrayRef<unsigned>(st_idx));
setNameWithField(ctx.emission_context, fldv, get_objname, jt, idx, Twine());
}
if (maybe_null) {
Expand Down Expand Up @@ -3278,7 +3278,7 @@ static Value *_boxed_special(jl_codectx_t &ctx, const jl_cgval_t &vinfo, Type *t
unsigned zero = 0;
Value *v = as_value(ctx, t, vinfo);
assert(v->getType() == ctx.emission_context.llvmtypes[jl_ssavalue_type]);
v = ctx.builder.CreateExtractValue(v, makeArrayRef(&zero, 1));
v = ctx.builder.CreateExtractValue(v, ArrayRef<unsigned>(&zero, 1));
box = call_with_attrs(ctx, box_ssavalue_func, v);
}
else if (!jb->name->abstract && jl_datatype_nbits(jb) == 0) {
Expand Down Expand Up @@ -3458,7 +3458,7 @@ static Function *mangleIntrinsic(IntrinsicInst *call) //mangling based on replac

auto newfType = FunctionType::get(
oldfType->getReturnType(),
makeArrayRef(argTys).slice(0, oldfType->getNumParams()),
ArrayRef<Type*>(argTys).slice(0, oldfType->getNumParams()),
oldfType->isVarArg());

// Accumulate an array of overloaded types for the given intrinsic
Expand Down Expand Up @@ -3714,7 +3714,7 @@ static Value *emit_new_bits(jl_codectx_t &ctx, Value *jt, Value *pval)
// if ptr is NULL this emits a write barrier _back_
static void emit_write_barrier(jl_codectx_t &ctx, Value *parent, Value *ptr)
{
emit_write_barrier(ctx, parent, makeArrayRef(ptr));
emit_write_barrier(ctx, parent, ArrayRef<Value*>(ptr));
}

static void emit_write_barrier(jl_codectx_t &ctx, Value *parent, ArrayRef<Value*> ptrs)
Expand Down Expand Up @@ -4013,7 +4013,7 @@ static jl_cgval_t emit_new_struct(jl_codectx_t &ctx, jl_value_t *ty, size_t narg
Value *fldp = ctx.builder.CreateConstInBoundsGEP1_32(ET, lv, i);
jl_aliasinfo_t ai = jl_aliasinfo_t::fromTBAA(ctx, ctx.tbaa().tbaa_stack);
Value *fldv = ai.decorateInst(ctx.builder.CreateAlignedLoad(ET, fldp, Align(al)));
strct = ctx.builder.CreateInsertValue(strct, fldv, makeArrayRef(llvm_idx + i));
strct = ctx.builder.CreateInsertValue(strct, fldv, ArrayRef<unsigned>(llvm_idx + i));
}
// emit remaining bytes up to tindex
if (i < ptindex - llvm_idx) {
Expand All @@ -4023,14 +4023,14 @@ static jl_cgval_t emit_new_struct(jl_codectx_t &ctx, jl_value_t *ty, size_t narg
Value *fldp = ctx.builder.CreateConstInBoundsGEP1_32(getInt8Ty(ctx.builder.getContext()), staddr, i);
jl_aliasinfo_t ai = jl_aliasinfo_t::fromTBAA(ctx, ctx.tbaa().tbaa_stack);
Value *fldv = ai.decorateInst(ctx.builder.CreateAlignedLoad(getInt8Ty(ctx.builder.getContext()), fldp, Align(1)));
strct = ctx.builder.CreateInsertValue(strct, fldv, makeArrayRef(llvm_idx + i));
strct = ctx.builder.CreateInsertValue(strct, fldv, ArrayRef<unsigned>(llvm_idx + i));
}
}
}
llvm_idx = ptindex;
fval = tindex;
if (jl_is_vecelement_type(ty))
fval = ctx.builder.CreateInsertValue(strct, fval, makeArrayRef(llvm_idx));
fval = ctx.builder.CreateInsertValue(strct, fval, ArrayRef<unsigned>(llvm_idx));
}
else {
Value *ptindex = emit_struct_gep(ctx, lt, strct, offs + fsz);
Expand All @@ -4057,7 +4057,7 @@ static jl_cgval_t emit_new_struct(jl_codectx_t &ctx, jl_value_t *ty, size_t narg
else if (lt->isVectorTy())
strct = ctx.builder.CreateInsertElement(strct, fval, ConstantInt::get(getInt32Ty(ctx.builder.getContext()), llvm_idx));
else if (lt->isAggregateType())
strct = ctx.builder.CreateInsertValue(strct, fval, makeArrayRef(llvm_idx));
strct = ctx.builder.CreateInsertValue(strct, fval, ArrayRef<unsigned>(llvm_idx));
else
assert(false);
}
Expand All @@ -4071,7 +4071,7 @@ static jl_cgval_t emit_new_struct(jl_codectx_t &ctx, jl_value_t *ty, size_t narg
int fsz = jl_field_size(sty, i) - 1;
unsigned llvm_idx = convert_struct_offset(ctx, cast<StructType>(lt), offs + fsz);
if (init_as_value)
strct = ctx.builder.CreateInsertValue(strct, ConstantInt::get(getInt8Ty(ctx.builder.getContext()), 0), makeArrayRef(llvm_idx));
strct = ctx.builder.CreateInsertValue(strct, ConstantInt::get(getInt8Ty(ctx.builder.getContext()), 0), ArrayRef<unsigned>(llvm_idx));
else {
jl_aliasinfo_t ai = jl_aliasinfo_t::fromTBAA(ctx, ctx.tbaa().tbaa_unionselbyte);
ai.decorateInst(ctx.builder.CreateAlignedStore(
Expand Down
16 changes: 8 additions & 8 deletions src/codegen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ struct jl_typecache_t {
};
static_assert(sizeof(jl_array_flags_t) == sizeof(int16_t),
"Size of jl_array_flags_t is not the same as int16_t");
T_jlarray = StructType::get(context, makeArrayRef(vaelts));
T_jlarray = StructType::get(context, ArrayRef<Type*>(vaelts));
T_pjlarray = PointerType::get(T_jlarray, 0);
}
};
Expand Down Expand Up @@ -605,7 +605,7 @@ AttributeSet Attributes(LLVMContext &C, std::initializer_list<Attribute::AttrKin
SmallVector<Attribute, 8> attrs(attrkinds.size());
for (size_t i = 0; i < attrkinds.size(); i++)
attrs[i] = Attribute::get(C, attrkinds.begin()[i]);
return AttributeSet::get(C, makeArrayRef(attrs));
return AttributeSet::get(C, ArrayRef<Attribute>(attrs));
}

static Type *get_pjlvalue(LLVMContext &C) { return JuliaType::get_pjlvalue_ty(C); }
Expand Down Expand Up @@ -1099,7 +1099,7 @@ static const auto jlapplytype_func = new JuliaFunction<>{
[](LLVMContext &C) {
return AttributeList::get(C,
AttributeSet(),
AttributeSet::get(C, makeArrayRef({Attribute::get(C, Attribute::NonNull),
AttributeSet::get(C, ArrayRef<Attribute>({Attribute::get(C, Attribute::NonNull),
Attribute::getWithAlignment(C, Align(16))})),
None);
},
Expand Down Expand Up @@ -1313,7 +1313,7 @@ static const auto except_enter_func = new JuliaFunction<>{
"julia.except_enter",
[](LLVMContext &C) { return FunctionType::get(getInt32Ty(C), false); },
[](LLVMContext &C) { return AttributeList::get(C,
AttributeSet::get(C, makeArrayRef({Attribute::get(C, Attribute::ReturnsTwice)})),
AttributeSet::get(C, ArrayRef<Attribute>({Attribute::get(C, Attribute::ReturnsTwice)})),
AttributeSet(),
None); },
};
Expand Down Expand Up @@ -3131,7 +3131,7 @@ static Value *emit_bits_compare(jl_codectx_t &ctx, jl_cgval_t arg1, jl_cgval_t a
nroots++;
if ((gc_uses[nroots] = get_gc_root_for(arg2)))
nroots++;
OperandBundleDef OpBundle("jl_roots", makeArrayRef(gc_uses, nroots));
OperandBundleDef OpBundle("jl_roots", ArrayRef<Value*>(gc_uses, nroots));
auto answer = ctx.builder.CreateCall(prepare_call(memcmp_func), {
ctx.builder.CreateBitCast(varg1, getInt8PtrTy(ctx.builder.getContext())),
ctx.builder.CreateBitCast(varg2, getInt8PtrTy(ctx.builder.getContext())),
Expand Down Expand Up @@ -5712,7 +5712,7 @@ static jl_cgval_t emit_expr(jl_codectx_t &ctx, jl_value_t *expr, ssize_t ssaidx_
Value *mdargs[] = { name, literal_pointer_val(ctx, (jl_value_t*)mod), bp, literal_pointer_val(ctx, bnd) };
jl_cgval_t gf = mark_julia_type(
ctx,
ctx.builder.CreateCall(prepare_call(jlgenericfunction_func), makeArrayRef(mdargs)),
ctx.builder.CreateCall(prepare_call(jlgenericfunction_func), ArrayRef<Value*>(mdargs)),
true,
jl_function_type);
return gf;
Expand All @@ -5731,7 +5731,7 @@ static jl_cgval_t emit_expr(jl_codectx_t &ctx, jl_value_t *expr, ssize_t ssaidx_
};
jl_cgval_t meth = mark_julia_type(
ctx,
ctx.builder.CreateCall(prepare_call(jlmethod_func), makeArrayRef(mdargs)),
ctx.builder.CreateCall(prepare_call(jlmethod_func), ArrayRef<Value*>(mdargs)),
true,
jl_method_type);
return meth;
Expand Down Expand Up @@ -7113,7 +7113,7 @@ static jl_returninfo_t get_specsig_function(jl_codectx_t &ctx, Module *M, Value
fsig.push_back(AT->getPointerTo());
argnames.push_back("union_bytes_return");
Type *pair[] = { ctx.types().T_prjlvalue, getInt8Ty(ctx.builder.getContext()) };
rt = StructType::get(ctx.builder.getContext(), makeArrayRef(pair));
rt = StructType::get(ctx.builder.getContext(), ArrayRef<Type*>(pair));
}
else if (allunbox) {
props.cc = jl_returninfo_t::Ghosts;
Expand Down
Loading

0 comments on commit 213c89b

Please sign in to comment.