While working on ClangIR to LLVM lowering, we want to generate this kind of LLVM IR code:
@_ZN1BD1Ev = dso_local unnamed_addr alias void (ptr), ptr @_ZN1BD2Ev
@_ZN1CD2Ev = dso_local unnamed_addr alias void (ptr), ptr @_ZN1BD2Ev
@_ZN1CD1Ev = dso_local unnamed_addr alias void (ptr), ptr @_ZN1BD2Ev
define dso_local void @_ZN1BD2Ev(ptr noundef nonnull align 8 dereferenceable(9) %this) unnamed_addr #0 {
However, one of the issues is that llvm.mlir.globals don't seem to accept anything besides !llvm.ptr as their types and there are no existing casts to use in its initializers that can allows us to load llvm.mlir.addressof as void (ptr). I tried several combinations but didn't get successful, let me know if I'm missing anything. The other reason we can't generate this is the missing alias, tracked in #115390