LLVM upstream dropped scalar TBAA tags support



I’ve been experimenting with Julia by linking it against LLVM upstream’s new (4.0) libraries and experiencing several problems in build stage.

Compiling initial julia executable was possible by small patch : changing header file of jitlayers.cpp (llvm/Bitcode/ReaderWriter.h) to llvm/Bitcode/BitcodeReader.h, llvm/Bitcode/BitcodeWriter.h

But when Julia tries to build sysimg, it fails with segmentation fault while compiling precompile.jl.

After linking Julia against Debug build of llvm, I found out assertion of method getMostGenericTBAA was failing because LLVM no longer supports scalar TBAA tags.

So apparently I’ll have to upgrade (TBAA)metadata node that Julia feeds to llvm by llvm::UpgradeTBAANode method to make llvm happy but as I don’t fully understand code generation stage of Julia I thought it would be really helpful if somebody could help me out.

Will upgrading tbaa nodes (tbaa_gcframe, tbaa_stack, etc) inside codegen.cpp’s init_julia_llvm_meta be enough?

Thanks for your time in advance.


Fixed by https://github.com/JuliaLang/julia/pull/19380


@yuyichao Thanks! Build passed on my OS X machine.

On the patch though, UpgradeTBAANode inside init_julia_llvm_meta also seems to work in my local machine. Can you test it too?

Or maybe we should continue our conversation on GitHub.


I don’t see why that’s better than creating the right metadata directly and AFAICT the messier part is that the parent node is not the same as the one attached to the instruction. At least that’s how clang does it and there’s currently no documentation on this.