Issue 115392
Summary Missing function pointer (e.g. `void (ptr)`) support in `mlir::LLVM::GlobalOp`
Labels mlir:llvm
Assignees
Reporter bcardosolopes
    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.global`s 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 https://github.com/llvm/llvm-project/issues/115390


_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to