Skip to content

Commit adc34fa

Browse files
committed
Alias information change for LLVM 21/22
1 parent f579080 commit adc34fa

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

src/cgutils.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1009,8 +1009,13 @@ static void emit_memcpy_llvm(jl_codectx_t &ctx, Value *dst, jl_aliasinfo_t const
10091009
// above problem won't be as serious.
10101010

10111011
auto merged_ai = dst_ai.merge(src_ai);
1012+
#if JL_LLVM_VERSION < 210000
10121013
ctx.builder.CreateMemCpy(dst, align_dst, src, align_src, sz, is_volatile,
10131014
merged_ai.tbaa, merged_ai.tbaa_struct, merged_ai.scope, merged_ai.noalias);
1015+
#else
1016+
ctx.builder.CreateMemCpy(dst, align_dst, src, align_src, sz, is_volatile,
1017+
merged_ai.toAAMDNodes());
1018+
#endif
10141019
}
10151020

10161021
static void emit_memcpy_llvm(jl_codectx_t &ctx, Value *dst, jl_aliasinfo_t const &dst_ai, Value *src,
@@ -1023,8 +1028,13 @@ static void emit_memcpy_llvm(jl_codectx_t &ctx, Value *dst, jl_aliasinfo_t const
10231028
++EmittedMemcpys;
10241029

10251030
auto merged_ai = dst_ai.merge(src_ai);
1031+
#if JL_LLVM_VERSION < 210000
10261032
ctx.builder.CreateMemCpy(dst, align_dst, src, align_src, sz, is_volatile,
10271033
merged_ai.tbaa, merged_ai.tbaa_struct, merged_ai.scope, merged_ai.noalias);
1034+
#else
1035+
ctx.builder.CreateMemCpy(dst, align_dst, src, align_src, sz, is_volatile,
1036+
merged_ai.toAAMDNodes());
1037+
#endif
10281038
}
10291039

10301040
template<typename T1>

src/codegen.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1702,6 +1702,15 @@ struct jl_aliasinfo_t {
17021702
// memory region non-aliasing. It should be deleted once the TBAA metadata
17031703
// is improved to encode only memory layout and *not* memory regions.
17041704
static jl_aliasinfo_t fromTBAA(jl_codectx_t &ctx, MDNode *tbaa);
1705+
1706+
AAMDNodes toAAMDNodes() const
1707+
{
1708+
#if JL_LLVM_VERSION < 220000
1709+
return AAMDNodes(tbaa, tbaa_struct, scope, noalias);
1710+
#else
1711+
return AAMDNodes(tbaa, tbaa_struct, scope, noalias, nullptr);
1712+
#endif
1713+
}
17051714
};
17061715

17071716
// metadata tracking for a llvm Value* during codegen

0 commit comments

Comments
 (0)