Skip to content
Open
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
15 changes: 7 additions & 8 deletions src/cgutils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ void jl_debugcache_t::initialize(Module *m) {
jl_di_func_sig = dbuilder.createSubroutineType(
dbuilder.getOrCreateTypeArray(diargs));
jl_di_func_null_sig = dbuilder.createSubroutineType(
dbuilder.getOrCreateTypeArray(None));
dbuilder.getOrCreateTypeArray({}));
}

static Value *emit_pointer_from_objref(jl_codectx_t &ctx, Value *V)
Expand Down Expand Up @@ -418,7 +418,7 @@ static Constant *julia_pgv(jl_codegen_params_t &params, Module *M, const char *c
// since the load at the new location satisfy the same condition as the original one.
// Mark the global as constant to LLVM code using our own metadata
// which is much less likely to be striped.
gv->setMetadata("julia.constgv", MDNode::get(gv->getContext(), None));
gv->setMetadata("julia.constgv", MDNode::get(gv->getContext(), {}));
assert(localname == gv->getName());
assert(!gv->hasInitializer());
return gv;
Expand Down Expand Up @@ -536,7 +536,7 @@ static inline Instruction *maybe_mark_load_dereferenceable(Instruction *LI, bool
if (isa<PointerType>(LI->getType())) {
if (!can_be_null)
// The `dereferenceable` below does not imply `nonnull` for non addrspace(0) pointers.
LI->setMetadata(LLVMContext::MD_nonnull, MDNode::get(LI->getContext(), None));
LI->setMetadata(LLVMContext::MD_nonnull, MDNode::get(LI->getContext(), {}));
if (size) {
Metadata *OP = ConstantAsMetadata::get(ConstantInt::get(getInt64Ty(LI->getContext()), size));
LI->setMetadata(can_be_null ? LLVMContext::MD_dereferenceable_or_null : LLVMContext::MD_dereferenceable,
Expand Down Expand Up @@ -1762,7 +1762,7 @@ static Value *emit_typeof(jl_codectx_t &ctx, Value *v, bool maybenull, bool just
Value *smallp = emit_ptrgep(ctx, prepare_global_in(M, jl_small_typeof_var), tag);
jl_aliasinfo_t ai = jl_aliasinfo_t::fromTBAA(ctx, ctx.tbaa().tbaa_const);
auto small = ctx.builder.CreateAlignedLoad(typetag->getType(), smallp, M->getDataLayout().getPointerABIAlignment(0));
small->setMetadata(LLVMContext::MD_nonnull, MDNode::get(M->getContext(), None));
small->setMetadata(LLVMContext::MD_nonnull, MDNode::get(M->getContext(), {}));
return ai.decorateInst(small);
});
});
Expand Down Expand Up @@ -2463,8 +2463,7 @@ static jl_cgval_t typed_store(jl_codectx_t &ctx,
FunctionType::get(StructType::get(elty, elty), {ptr->getType(), ctx.builder.getPtrTy(), ctx.builder.getInt8Ty(), ctx.builder.getInt8Ty()}, true),
AttributeList::get(elty->getContext(),
Attributes(elty->getContext(), {Attribute::NoMerge}), // prevent llvm from merging calls to different functions
AttributeSet(),
None));
AttributeSet(), {}));
SmallVector<Value*,0> Args = {ptr, op, ctx.builder.getInt8((unsigned)Order), ctx.builder.getInt8(SyncScope::System)};
if (rhs.V)
Args.push_back(rhs.V);
Expand Down Expand Up @@ -3389,7 +3388,7 @@ static Value *emit_genericmemoryptr(jl_codectx_t &ctx, Value *mem, const jl_data
PointerType *PPT = cast<PointerType>(ctx.types().T_jlgenericmemory->getElementType(1));
LoadInst *LI = ctx.builder.CreateAlignedLoad(PPT, addr, Align(sizeof(char*)));
LI->setOrdering(AtomicOrdering::NotAtomic);
LI->setMetadata(LLVMContext::MD_nonnull, MDNode::get(ctx.builder.getContext(), None));
LI->setMetadata(LLVMContext::MD_nonnull, MDNode::get(ctx.builder.getContext(), {}));
jl_aliasinfo_t aliasinfo = jl_aliasinfo_t::fromTBAA(ctx, ctx.tbaa().tbaa_memoryptr);
aliasinfo.decorateInst(LI);
Value *ptr = LI;
Expand All @@ -3408,7 +3407,7 @@ static Value *emit_genericmemoryowner(jl_codectx_t &ctx, Value *t)
Type *T_data = ctx.types().T_jlgenericmemory->getElementType(1);
LoadInst *LI = ctx.builder.CreateAlignedLoad(T_data, addr, Align(sizeof(char*)));
LI->setOrdering(AtomicOrdering::NotAtomic);
LI->setMetadata(LLVMContext::MD_nonnull, MDNode::get(ctx.builder.getContext(), None));
LI->setMetadata(LLVMContext::MD_nonnull, MDNode::get(ctx.builder.getContext(), {}));
jl_aliasinfo_t aliasinfo_mem = jl_aliasinfo_t::fromTBAA(ctx, ctx.tbaa().tbaa_memoryown);
aliasinfo_mem.decorateInst(LI);
addr = emit_ptrgep(ctx, m, JL_SMALL_BYTE_ALIGNMENT);
Expand Down
64 changes: 32 additions & 32 deletions src/codegen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -625,15 +625,15 @@ static AttributeList get_attrs_noreturn(LLVMContext &C)
return AttributeList::get(C,
Attributes(C, {Attribute::NoReturn}),
AttributeSet(),
None);
{});
}

static AttributeList get_attrs_basic(LLVMContext &C)
{
return AttributeList::get(C,
AttributeSet(),
Attributes(C, {Attribute::NonNull}),
None);
{});
}

static AttributeList get_attrs_box_float(LLVMContext &C, unsigned nbytes)
Expand All @@ -649,7 +649,7 @@ static AttributeList get_attrs_box_float(LLVMContext &C, unsigned nbytes)
return AttributeList::get(C,
AttributeSet::get(C, FnAttrs),
AttributeSet::get(C, RetAttrs),
None);
{});
}

static AttributeList get_attrs_box_sext(LLVMContext &C, unsigned nbytes)
Expand Down Expand Up @@ -936,7 +936,7 @@ static const auto jltopeval_func = new JuliaFunction<>{
[](LLVMContext &C) { return AttributeList::get(C,
AttributeSet(),
Attributes(C, {Attribute::NonNull}),
None); },
{}); },
};
static const auto jlcopyast_func = new JuliaFunction<>{
XSTR(jl_copy_ast),
Expand All @@ -948,7 +948,7 @@ static const auto jlcopyast_func = new JuliaFunction<>{
[](LLVMContext &C) { return AttributeList::get(C,
AttributeSet(),
Attributes(C, {Attribute::NonNull}),
None); },
{}); },
};
static const auto jlapplygeneric_func = new JuliaFunction<>{
XSTR(jl_apply_generic),
Expand Down Expand Up @@ -1054,7 +1054,7 @@ static const auto jlleave_func = new JuliaFunction<>{
return AttributeList::get(C,
AttributeSet::get(C, FnAttrs),
AttributeSet(),
None);
{});
},
};
static const auto jlleave_noexcept_func = new JuliaFunction<>{
Expand All @@ -1071,7 +1071,7 @@ static const auto jlleave_noexcept_func = new JuliaFunction<>{
return AttributeList::get(C,
AttributeSet::get(C, FnAttrs),
AttributeSet(),
None);
{});
},
};
static const auto jl_restore_excstack_func = new JuliaFunction<TypeFnContextAndSizeT>{
Expand Down Expand Up @@ -1101,7 +1101,7 @@ static const auto jlegalx_func = new JuliaFunction<TypeFnContextAndSizeT>{
return AttributeList::get(C,
AttributeSet::get(C, FnAttrs),
AttributeSet(),
None); },
{}); },
};
static const auto jl_alloc_obj_func = new JuliaFunction<TypeFnContextAndSizeT>{
"julia.gc_alloc_obj",
Expand All @@ -1125,7 +1125,7 @@ static const auto jl_alloc_obj_func = new JuliaFunction<TypeFnContextAndSizeT>{
return AttributeList::get(C,
AttributeSet::get(C, FnAttrs),
AttributeSet::get(C, RetAttrs),
None);
{});
},
};
static const auto jl_alloc_genericmemory_unchecked_func = new JuliaFunction<TypeFnContextAndSizeT>{
Expand All @@ -1149,7 +1149,7 @@ static const auto jl_alloc_genericmemory_unchecked_func = new JuliaFunction<Type
return AttributeList::get(C,
AttributeSet::get(C, FnAttrs),
AttributeSet::get(C, RetAttrs),
None);
{});
},
};
static const auto jl_newbits_func = new JuliaFunction<>{
Expand All @@ -1162,7 +1162,7 @@ static const auto jl_newbits_func = new JuliaFunction<>{
[](LLVMContext &C) { return AttributeList::get(C,
AttributeSet(),
Attributes(C, {Attribute::NonNull}),
None); },
{}); },
};
// `julia.typeof` does read memory, but it is effectively readnone before we lower
// the allocation function. This is OK as long as we lower `julia.typeof` no later than
Expand All @@ -1182,7 +1182,7 @@ static const auto jl_typeof_func = new JuliaFunction<>{
return AttributeList::get(C,
AttributeSet::get(C, FnAttrs),
Attributes(C, {Attribute::NonNull}),
None); },
{}); },
};

static const auto jl_write_barrier_func = new JuliaFunction<>{
Expand Down Expand Up @@ -1234,7 +1234,7 @@ static const auto jlapplytype_func = new JuliaFunction<>{
AttributeSet(),
AttributeSet::get(C, ArrayRef<Attribute>({Attribute::get(C, Attribute::NonNull),
Attribute::getWithAlignment(C, Align(16))})),
None);
{});
},
};
static const auto jl_object_id__func = new JuliaFunction<TypeFnContextAndSizeT>{
Expand All @@ -1255,7 +1255,7 @@ static const auto setjmp_func = new JuliaFunction<TypeFnContextAndTriple>{
[](LLVMContext &C) { return AttributeList::get(C,
Attributes(C, {Attribute::ReturnsTwice}),
AttributeSet(),
None); },
{}); },
};
static const auto memcmp_func = new JuliaFunction<TypeFnContextAndSizeT>{
XSTR(memcmp),
Expand All @@ -1268,7 +1268,7 @@ static const auto memcmp_func = new JuliaFunction<TypeFnContextAndSizeT>{
return AttributeList::get(C,
AttributeSet::get(C, FnAttrs),
AttributeSet(),
None); },
{}); },
// TODO: inferLibFuncAttributes(*memcmp_func, TLI);
};
static const auto jldlsym_func = new JuliaFunction<>{
Expand Down Expand Up @@ -1302,7 +1302,7 @@ static const auto jlgetnthfieldchecked_func = new JuliaFunction<TypeFnContextAnd
[](LLVMContext &C) { return AttributeList::get(C,
AttributeSet(),
Attributes(C, {Attribute::NonNull}),
None); },
{}); },
};
static const auto jlfieldindex_func = new JuliaFunction<>{
XSTR(jl_field_index),
Expand All @@ -1319,7 +1319,7 @@ static const auto jlfieldindex_func = new JuliaFunction<>{
return AttributeList::get(C,
AttributeSet::get(C, FnAttrs),
AttributeSet(),
None); }, // This function can error if the third argument is 1 so don't do that.
{}); }, // This function can error if the third argument is 1 so don't do that.
};
static const auto jlfieldisdefinedchecked_func = new JuliaFunction<TypeFnContextAndSizeT>{
XSTR(jl_field_isdefined_checked),
Expand All @@ -1331,7 +1331,7 @@ static const auto jlfieldisdefinedchecked_func = new JuliaFunction<TypeFnContext
[](LLVMContext &C) { return AttributeList::get(C,
AttributeSet(),
Attributes(C, {}),
None); },
{}); },
};
static const auto jlgetcfunctiontrampoline_func = new JuliaFunction<>{
XSTR(jl_get_cfunction_trampoline),
Expand All @@ -1353,7 +1353,7 @@ static const auto jlgetcfunctiontrampoline_func = new JuliaFunction<>{
[](LLVMContext &C) { return AttributeList::get(C,
AttributeSet(),
Attributes(C, {Attribute::NonNull}),
None); },
{}); },
};
static const auto jlgetabiconverter_func = new JuliaFunction<TypeFnContextAndSizeT>{
XSTR(jl_get_abi_converter),
Expand Down Expand Up @@ -1393,7 +1393,7 @@ static const auto jl_allocgenericmemory = new JuliaFunction<TypeFnContextAndSize
return AttributeList::get(C,
AttributeSet::get(C, FnAttrs),
AttributeSet::get(C, RetAttrs),
None); },
{}); },
};
#define BOX_FUNC(ct,at,attrs,nbytes) \
static const auto box_##ct##_func = new JuliaFunction<>{ \
Expand Down Expand Up @@ -1435,7 +1435,7 @@ static const auto jldnd_func = new JuliaFunction<>{
return AttributeList::get(C,
AttributeSet::get(C, FnAttrs),
Attributes(C, {}),
None);
{});
},
};

Expand Down Expand Up @@ -1470,7 +1470,7 @@ static const auto pointer_from_objref_func = new JuliaFunction<>{
return AttributeList::get(C,
AttributeSet::get(C, FnAttrs),
Attributes(C, {Attribute::NonNull}),
None); },
{}); },
};
static const auto gc_loaded_func = new JuliaFunction<>{
"julia.gc_loaded",
Expand Down Expand Up @@ -1665,7 +1665,7 @@ struct jl_aliasinfo_t {
MDNode *operand = cast<MDNode>(this->scope->getOperand(0));
auto scope_name = cast<MDString>(operand->getOperand(0))->getString();
if (scope_name == "jnoalias_const")
inst->setMetadata(LLVMContext::MD_invariant_load, MDNode::get(inst->getContext(), None));
inst->setMetadata(LLVMContext::MD_invariant_load, MDNode::get(inst->getContext(), {}));
}
}

Expand Down Expand Up @@ -2017,7 +2017,7 @@ jl_aliasinfo_t jl_aliasinfo_t::fromTBAA(jl_codectx_t &ctx, MDNode *tbaa) {

static Type *julia_type_to_llvm(jl_codectx_t &ctx, jl_value_t *jt, bool *isboxed = NULL);
static jl_returninfo_t get_specsig_function(jl_codegen_params_t &ctx, Module *M, Value *fval, StringRef name, jl_value_t *sig, jl_value_t *jlrettype, bool is_opaque_closure,
ArrayRef<const char*> ArgNames=None, unsigned nreq=0);
ArrayRef<const char*> ArgNames={}, unsigned nreq=0);
static jl_cgval_t emit_expr(jl_codectx_t &ctx, jl_value_t *expr, ssize_t ssaval = -1);
static jl_cgval_t emit_checked_var(jl_codectx_t &ctx, Value *bp, jl_sym_t *name, jl_value_t *scope, bool isvol, MDNode *tbaa);
static jl_cgval_t emit_sparam(jl_codectx_t &ctx, size_t i);
Expand Down Expand Up @@ -2195,7 +2195,7 @@ static inline jl_cgval_t ghostValue(jl_codectx_t &ctx, jl_value_t *typ)
if (jl_is_type_type(typ)) {
assert(is_uniquerep_Type(typ));
// replace T::Type{T} with T, by assuming that T must be a leaftype of some sort
jl_cgval_t constant(NULL, true, typ, NULL, best_tbaa(ctx.tbaa(), typ), None);
jl_cgval_t constant(NULL, true, typ, NULL, best_tbaa(ctx.tbaa(), typ), ArrayRef<Value*>());
constant.constant = jl_tparam0(typ);
if (typ == (jl_value_t*)jl_typeofbottom_type->super)
constant.isghost = true;
Expand All @@ -2219,13 +2219,13 @@ static inline jl_cgval_t mark_julia_const(jl_codectx_t &ctx, jl_value_t *jv)
if (jl_is_datatype_singleton((jl_datatype_t*)typ))
return ghostValue(ctx, typ);
}
jl_cgval_t constant(NULL, true, typ, NULL, best_tbaa(ctx.tbaa(), typ), None);
jl_cgval_t constant(NULL, true, typ, NULL, best_tbaa(ctx.tbaa(), typ), ArrayRef<Value*>());
constant.constant = jv;
return constant;
}


static inline jl_cgval_t mark_julia_slot(Value *v, jl_value_t *typ, Value *tindex, MDNode *tbaa, ArrayRef<Value*> inline_roots=None)
static inline jl_cgval_t mark_julia_slot(Value *v, jl_value_t *typ, Value *tindex, MDNode *tbaa, ArrayRef<Value*> inline_roots={})
{
// this enables lazy-copying of immutable values and stack or argument slots
jl_cgval_t tagval(v, false, typ, tindex, tbaa, inline_roots);
Expand Down Expand Up @@ -2311,7 +2311,7 @@ static inline jl_cgval_t mark_julia_type(jl_codectx_t &ctx, Value *v, bool isbox
return value_to_pointer(ctx, v, typ, NULL);
}
if (isboxed)
return jl_cgval_t(v, isboxed, typ, NULL, best_tbaa(ctx.tbaa(), typ), None);
return jl_cgval_t(v, isboxed, typ, NULL, best_tbaa(ctx.tbaa(), typ), ArrayRef<Value*>());
return jl_cgval_t(v, typ, NULL);
}

Expand Down Expand Up @@ -2590,7 +2590,7 @@ static jl_cgval_t convert_julia_type_union(jl_codectx_t &ctx, const jl_cgval_t &
}
}
else {
return jl_cgval_t(boxed(ctx, v), true, typ, NULL, best_tbaa(ctx.tbaa(), typ), None);
return jl_cgval_t(boxed(ctx, v), true, typ, NULL, best_tbaa(ctx.tbaa(), typ), ArrayRef<Value*>());
}
return jl_cgval_t(v, typ, new_tindex);
}
Expand Down Expand Up @@ -5641,7 +5641,7 @@ static jl_cgval_t emit_varinfo(jl_codectx_t &ctx, jl_varinfo_t &vi, jl_sym_t *va
Value *tindex = NULL;
if (vi.pTIndex)
tindex = ctx.builder.CreateAlignedLoad(getInt8Ty(ctx.builder.getContext()), vi.pTIndex, Align(1), vi.isVolatile);
v = mark_julia_slot(ssaslot, vi.value.typ, tindex, ctx.tbaa().tbaa_stack, None);
v = mark_julia_slot(ssaslot, vi.value.typ, tindex, ctx.tbaa().tbaa_stack);
}
if (vi.inline_roots) {
AllocaInst *varslot = vi.inline_roots;
Expand Down Expand Up @@ -6599,7 +6599,7 @@ static jl_cgval_t emit_expr(jl_codectx_t &ctx, jl_value_t *expr, ssize_t ssaidx_
SmallVector<Metadata *, 8> MDs;

// Reserve first location for self reference to the LoopID metadata node.
TempMDTuple TempNode = MDNode::getTemporary(ctx.builder.getContext(), None);
TempMDTuple TempNode = MDNode::getTemporary(ctx.builder.getContext(), {});
MDs.push_back(TempNode.get());

for (int i = 0, ie = nargs; i < ie; ++i) {
Expand Down Expand Up @@ -8634,7 +8634,7 @@ static jl_llvm_functions_t
AllocaInst *roots = sizes.second > 0 ? emit_static_roots(ctx, sizes.second) : nullptr;
if (bits) bits->setName(jl_symbol_name(s));
if (roots) roots->setName(StringRef(".roots.") + jl_symbol_name(s));
varinfo.value = mark_julia_slot(bits, jt, NULL, ctx.tbaa().tbaa_stack, None);
varinfo.value = mark_julia_slot(bits, jt, NULL, ctx.tbaa().tbaa_stack, {});
varinfo.inline_roots = roots;
alloc_def_flag(ctx, varinfo);
if (debug_enabled && varinfo.dinfo) {
Expand Down
2 changes: 1 addition & 1 deletion src/llvm-codegen-shared.h
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ static inline llvm::Instruction *tbaa_decorate(llvm::MDNode *md, llvm::Instructi
using namespace llvm;
inst->setMetadata(llvm::LLVMContext::MD_tbaa, md);
if (llvm::isa<llvm::LoadInst>(inst) && md && md == get_tbaa_const(md->getContext())) {
inst->setMetadata(llvm::LLVMContext::MD_invariant_load, llvm::MDNode::get(md->getContext(), std::nullopt));
inst->setMetadata(llvm::LLVMContext::MD_invariant_load, llvm::MDNode::get(md->getContext(), {}));
}
return inst;
}
Expand Down
2 changes: 1 addition & 1 deletion src/llvm-late-gc-lowering.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2291,7 +2291,7 @@ bool LateLowerGCFrame::CleanupIR(Function &F, State *S, bool *CFGModified) {
} else {
// remove all operand bundles
#if JL_LLVM_VERSION >= 200000
CallInst *NewCall = CallInst::Create(CI, None, CI->getIterator());
CallInst *NewCall = CallInst::Create(CI, {}, CI->getIterator());
#else
CallInst *NewCall = CallInst::Create(CI, None, CI);
#endif
Expand Down
4 changes: 2 additions & 2 deletions src/llvm-multiversioning.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -687,7 +687,7 @@ void CloneCtx::rewrite_alias(GlobalAlias *alias, Function *F)

auto ptr = irbuilder.CreateLoad(F->getType(), slot);
ptr->setMetadata(llvm::LLVMContext::MD_tbaa, tbaa_const);
ptr->setMetadata(llvm::LLVMContext::MD_invariant_load, MDNode::get(F->getContext(), None));
ptr->setMetadata(llvm::LLVMContext::MD_invariant_load, MDNode::get(F->getContext(), {}));

SmallVector<Value *, 0> Args;
for (auto &arg : trampoline->args())
Expand Down Expand Up @@ -846,7 +846,7 @@ static void replaceUsesWithLoad(Function &F, Type *T_size, I2GV should_replace,
#endif
Instruction *ptr = new LoadInst(F.getType(), slot, "", false, insert_before);
ptr->setMetadata(llvm::LLVMContext::MD_tbaa, tbaa_const);
ptr->setMetadata(llvm::LLVMContext::MD_invariant_load, MDNode::get(ptr->getContext(), None));
ptr->setMetadata(llvm::LLVMContext::MD_invariant_load, MDNode::get(ptr->getContext(), {}));
use_i->setOperand(info.use->getOperandNo(),
rewrite_inst_use(uses.get_stack(), T_size, ptr,
insert_before));
Expand Down
Loading