JuliaLang/julia

Encode type-/layout- vs. region-based alias info separately in LLVM IR

Open

#54,395 创建于 2024年5月7日

在 GitHub 查看
 (0 评论) (2 反应) (0 负责人)Julia (5,773 fork)batch import
compiler:codegencompiler:llvmhelp wanted

仓库指标

Star
 (48,709 star)
PR 合并指标
 (平均合并 20天 6小时) (30 天内合并 157 个 PR)

描述

Currently we redundantly encode region information in both !tbaa and !alias.scope metadata for LLVM.

We'd like to separate these so that TBAA is only used to encode the layout-/type-based non-aliasing information, and !alias.scope is used just for the region-based information.

For reference, here's the existing TBAA hierarchy: https://github.com/JuliaLang/julia/blob/5f7bfc0a8374a902b723870262ffe7ddfbc44e77/src/codegen.cpp#L351-L375

The first step is probably to (1) re-factor the code to stop using ::fromTBAA. Instead, the region information should be passed around as a separate piece of aliasing-related information. Most likely that means creating a jl_aliasinfo_t much earlier, and updating jl_cgval_t to carry it instead of just TBAA metadata. Then, (2) remove tbaa_gcframe, tbaa_stack, tbaa_const, and tbaa_data from the TBAA hierarchy.

Afterwards, an excellent follow-up will be to expand the TBAA hierarchy to encode a much broader set of types into it, including ideally user-defined structs.

贡献者指南