Skip to content

Commit 84ef118

Browse files
authored
Fix codegen compilation warnings. (#36847)
* uninitialized field warning * LLVM 10 deprecation warning for CreateMemCpy
1 parent f2319b5 commit 84ef118

File tree

4 files changed

+30
-7
lines changed

4 files changed

+30
-7
lines changed

src/ccall.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1697,15 +1697,15 @@ static jl_cgval_t emit_ccall(jl_codectx_t &ctx, jl_value_t **args, size_t nargs)
16971697

16981698
ctx.builder.CreateMemCpy(
16991699
ctx.builder.CreateIntToPtr(destp, T_pint8),
1700-
#if JL_LLVM_VERSION >= 110000
1700+
#if JL_LLVM_VERSION >= 100000
17011701
MaybeAlign(1),
17021702
#else
17031703
1,
17041704
#endif
17051705
ctx.builder.CreateIntToPtr(
17061706
emit_unbox(ctx, T_size, src, (jl_value_t*)jl_voidpointer_type),
17071707
T_pint8),
1708-
#if JL_LLVM_VERSION >= 110000
1708+
#if JL_LLVM_VERSION >= 100000
17091709
MaybeAlign(0),
17101710
#else
17111711
0,

src/cgutils.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1477,7 +1477,7 @@ static void emit_memcpy_llvm(jl_codectx_t &ctx, Value *dst, MDNode *tbaa_dst, Va
14771477
// for the load part (x.tbaa) and the store part (tbaa_stack).
14781478
// since the tbaa lattice has to be a tree we have unfortunately
14791479
// x.tbaa ∪ tbaa_stack = tbaa_root if x.tbaa != tbaa_stack
1480-
#if JL_LLVM_VERSION >= 110000
1480+
#if JL_LLVM_VERSION >= 100000
14811481
ctx.builder.CreateMemCpy(dst, MaybeAlign(align), src, MaybeAlign(0), sz, is_volatile, MDNode::getMostGenericTBAA(tbaa_dst, tbaa_src));
14821482
#else
14831483
ctx.builder.CreateMemCpy(dst, align, src, 0, sz, is_volatile, MDNode::getMostGenericTBAA(tbaa_dst, tbaa_src));
@@ -1491,7 +1491,7 @@ static void emit_memcpy_llvm(jl_codectx_t &ctx, Value *dst, MDNode *tbaa_dst, Va
14911491
emit_memcpy_llvm(ctx, dst, tbaa_dst, src, tbaa_src, const_sz->getZExtValue(), align, is_volatile);
14921492
return;
14931493
}
1494-
#if JL_LLVM_VERSION >= 110000
1494+
#if JL_LLVM_VERSION >= 100000
14951495
ctx.builder.CreateMemCpy(dst, MaybeAlign(align), src, MaybeAlign(0), sz, is_volatile, MDNode::getMostGenericTBAA(tbaa_dst, tbaa_src));
14961496
#else
14971497
ctx.builder.CreateMemCpy(dst, align, src, 0, sz, is_volatile, MDNode::getMostGenericTBAA(tbaa_dst, tbaa_src));

src/codegen.cpp

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -407,6 +407,7 @@ static const auto jlgetworld_global = new JuliaVariable{
407407
static const auto jltls_states_func = new JuliaFunction{
408408
"julia.ptls_states",
409409
[](LLVMContext &C) { return FunctionType::get(PointerType::get(T_ppjlvalue, 0), false); },
410+
nullptr,
410411
};
411412

412413

@@ -476,21 +477,25 @@ static const auto jlcheckassign_func = new JuliaFunction{
476477
"jl_checked_assignment",
477478
[](LLVMContext &C) { return FunctionType::get(T_void,
478479
{T_pjlvalue, PointerType::get(T_jlvalue, AddressSpace::CalleeRooted)}, false); },
480+
nullptr,
479481
};
480482
static const auto jldeclareconst_func = new JuliaFunction{
481483
"jl_declare_constant",
482484
[](LLVMContext &C) { return FunctionType::get(T_void,
483485
{T_pjlvalue}, false); },
486+
nullptr,
484487
};
485488
static const auto jlgetbindingorerror_func = new JuliaFunction{
486489
"jl_get_binding_or_error",
487490
[](LLVMContext &C) { return FunctionType::get(T_pjlvalue,
488491
{T_pjlvalue, T_pjlvalue}, false); },
492+
nullptr,
489493
};
490494
static const auto jlboundp_func = new JuliaFunction{
491495
"jl_boundp",
492496
[](LLVMContext &C) { return FunctionType::get(T_int32,
493497
{T_pjlvalue, T_pjlvalue}, false); },
498+
nullptr,
494499
};
495500
static const auto jltopeval_func = new JuliaFunction{
496501
"jl_toplevel_eval",
@@ -538,40 +543,48 @@ static const auto jlmethod_func = new JuliaFunction{
538543
"jl_method_def",
539544
[](LLVMContext &C) { return FunctionType::get(T_void,
540545
{T_prjlvalue, T_prjlvalue, T_pjlvalue}, false); },
546+
nullptr,
541547
};
542548
static const auto jlgenericfunction_func = new JuliaFunction{
543549
"jl_generic_function_def",
544550
[](LLVMContext &C) { return FunctionType::get(T_prjlvalue,
545551
{T_pjlvalue, T_pjlvalue, T_pprjlvalue, T_pjlvalue, T_pjlvalue}, false); },
552+
nullptr,
546553
};
547554
static const auto jlenter_func = new JuliaFunction{
548555
"jl_enter_handler",
549556
[](LLVMContext &C) { return FunctionType::get(T_void,
550557
{T_pint8}, false); },
558+
nullptr,
551559
};
552560
static const auto jl_current_exception_func = new JuliaFunction{
553561
"jl_current_exception",
554562
[](LLVMContext &C) { return FunctionType::get(T_prjlvalue, false); },
563+
nullptr,
555564
};
556565
static const auto jlleave_func = new JuliaFunction{
557566
"jl_pop_handler",
558567
[](LLVMContext &C) { return FunctionType::get(T_void,
559568
{T_int32}, false); },
569+
nullptr,
560570
};
561571
static const auto jl_restore_excstack_func = new JuliaFunction{
562572
"jl_restore_excstack",
563573
[](LLVMContext &C) { return FunctionType::get(T_void,
564574
{T_size}, false); },
575+
nullptr,
565576
};
566577
static const auto jl_excstack_state_func = new JuliaFunction{
567578
"jl_excstack_state",
568579
[](LLVMContext &C) { return FunctionType::get(T_size, false); },
580+
nullptr,
569581
};
570582
static const auto jlegal_func = new JuliaFunction{
571583
"jl_egal",
572584
[](LLVMContext &C) {
573585
Type *T = PointerType::get(T_jlvalue, AddressSpace::CalleeRooted);
574586
return FunctionType::get(T_int32, {T, T}, false); },
587+
nullptr,
575588
};
576589
static const auto jl_alloc_obj_func = new JuliaFunction{
577590
"julia.gc_alloc_obj",
@@ -621,12 +634,14 @@ static const auto jlisa_func = new JuliaFunction{
621634
"jl_isa",
622635
[](LLVMContext &C) { return FunctionType::get(T_int32,
623636
{T_prjlvalue, T_prjlvalue}, false); },
637+
nullptr,
624638
};
625639

626640
static const auto jlsubtype_func = new JuliaFunction{
627641
"jl_subtype",
628642
[](LLVMContext &C) { return FunctionType::get(T_int32,
629643
{T_prjlvalue, T_prjlvalue}, false); },
644+
nullptr,
630645
};
631646
static const auto jlapplytype_func = new JuliaFunction{
632647
"jl_instantiate_type_in_env",
@@ -641,6 +656,7 @@ static const auto jl_object_id__func = new JuliaFunction{
641656
"jl_object_id_",
642657
[](LLVMContext &C) { return FunctionType::get(T_size,
643658
{T_prjlvalue, PointerType::get(T_int8, AddressSpace::Derived)}, false); },
659+
nullptr,
644660
};
645661
static const auto setjmp_func = new JuliaFunction{
646662
jl_setjmp_name,
@@ -669,11 +685,13 @@ static const auto jldlsym_func = new JuliaFunction{
669685
"jl_load_and_lookup",
670686
[](LLVMContext &C) { return FunctionType::get(T_pvoidfunc,
671687
{T_pint8, T_pint8, PointerType::get(T_pint8, 0)}, false); },
688+
nullptr,
672689
};
673690
static const auto jltypeassert_func = new JuliaFunction{
674691
"jl_typeassert",
675692
[](LLVMContext &C) { return FunctionType::get(T_void,
676693
{T_prjlvalue, T_prjlvalue}, false); },
694+
nullptr,
677695
};
678696
static const auto jlgetnthfieldchecked_func = new JuliaFunction{
679697
"jl_get_nth_field_checked",
@@ -704,11 +722,13 @@ static const auto jlgetcfunctiontrampoline_func = new JuliaFunction{
704722
static const auto diff_gc_total_bytes_func = new JuliaFunction{
705723
"jl_gc_diff_total_bytes",
706724
[](LLVMContext &C) { return FunctionType::get(T_int64, false); },
725+
nullptr,
707726
};
708727
static const auto sync_gc_total_bytes_func = new JuliaFunction{
709728
"jl_gc_sync_total_bytes",
710729
[](LLVMContext &C) { return FunctionType::get(T_int64,
711730
{T_int64}, false); },
731+
nullptr,
712732
};
713733
static const auto jlarray_data_owner_func = new JuliaFunction{
714734
"jl_array_data_owner",
@@ -745,14 +765,17 @@ BOX_FUNC(ssavalue, T_prjlvalue, T_size, nullptr);
745765
static const auto gcroot_flush_func = new JuliaFunction{
746766
"julia.gcroot_flush",
747767
[](LLVMContext &C) { return FunctionType::get(T_void, false); },
768+
nullptr,
748769
};
749770
static const auto gc_preserve_begin_func = new JuliaFunction{
750771
"llvm.julia.gc_preserve_begin",
751772
[](LLVMContext &C) { return FunctionType::get(Type::getTokenTy(C), true); },
773+
nullptr,
752774
};
753775
static const auto gc_preserve_end_func = new JuliaFunction {
754776
"llvm.julia.gc_preserve_end",
755777
[](LLVMContext &C) { return FunctionType::get(T_void, {Type::getTokenTy(C)}, false); },
778+
nullptr,
756779
};
757780
static const auto except_enter_func = new JuliaFunction{
758781
"julia.except_enter",
@@ -3796,7 +3819,7 @@ static void emit_phinode_assign(jl_codectx_t &ctx, ssize_t idx, jl_value_t *r)
37963819
Value *isboxed = ctx.builder.CreateICmpNE(
37973820
ctx.builder.CreateAnd(Tindex_phi, ConstantInt::get(T_int8, 0x80)),
37983821
ConstantInt::get(T_int8, 0));
3799-
#if JL_LLVM_VERSION >= 110000
3822+
#if JL_LLVM_VERSION >= 100000
38003823
ctx.builder.CreateMemCpy(phi, MaybeAlign(min_align), dest, MaybeAlign(0), nbytes, false);
38013824
#else
38023825
ctx.builder.CreateMemCpy(phi, min_align, dest, 0, nbytes, false);
@@ -3840,7 +3863,7 @@ static void emit_phinode_assign(jl_codectx_t &ctx, ssize_t idx, jl_value_t *r)
38403863
// here it's moved into phi in the successor (from dest)
38413864
dest = emit_static_alloca(ctx, vtype);
38423865
Value *phi = emit_static_alloca(ctx, vtype);
3843-
#if JL_LLVM_VERSION >= 110000
3866+
#if JL_LLVM_VERSION >= 100000
38443867
ctx.builder.CreateMemCpy(phi, MaybeAlign(julia_alignment(phiType)),
38453868
dest, MaybeAlign(0),
38463869
jl_datatype_size(phiType), false);

src/intrinsics.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ FunctionType *get_intr_args3(LLVMContext &C) { return FunctionType::get(T_prjlva
1414
FunctionType *get_intr_args4(LLVMContext &C) { return FunctionType::get(T_prjlvalue, {T_prjlvalue, T_prjlvalue, T_prjlvalue, T_prjlvalue}, false); }
1515

1616
static JuliaFunction *runtime_func[num_intrinsics] = {
17-
#define ADD_I(name, nargs) new JuliaFunction{"jl_"#name, get_intr_args##nargs},
17+
#define ADD_I(name, nargs) new JuliaFunction{"jl_"#name, get_intr_args##nargs, nullptr},
1818
#define ADD_HIDDEN ADD_I
1919
#define ALIAS(alias, base) nullptr,
2020
INTRINSICS

0 commit comments

Comments
 (0)