Skip to content

Use void (ptr) on LLVM::GlobalOp when available in LLVM dialect to represent aliased functions #1083

@bcardosolopes

Description

@bcardosolopes

Similar issue from #1065, we cannot use globals at all (even if we ignore the absence of alias) to start representing aliases. llvm.mlir.globals don't seem to accept anything besides !llvm.ptr as it's types and there are no existing casts to use in its initializers that can allows us to map from llvm.mlir.addressof.

To be more concrete, I want to generate this following 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 {
...

This also needs to be filed against upstream MLIR.

Metadata

Metadata

Assignees

No one assigned

    Labels

    IR differenceA difference in ClangIR-generated LLVM IR that could complicate reusing original CodeGen testsblocked-by-mlir-support

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions