[llvm] [Intrinsics] Make `patchpoint.i64` generic on its return type (PR #85911)

via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 22 06:34:45 PDT 2024


Il-Capitano wrote:

> lgtm, but I know nothing about these intrinsics (but arbitrary type constraints on intrinsics are often bad)

Patchpoints lower to function calls, along with some metadata in stackmap entry, which allows a runtime (e.g. a lazy JIT) to patch those calls in the generated machine code after compilation. So I think any valid function return type should be valid for patchpoints as well.

I constrained the return type because of two concerns:
* If `anyregcc` is used, `SelectionDAGBuilder` expects a single `EVT` result when computing the patchpoint node type. For any other calling convention, it seems to handle the return type as any other regular function, so the constraint may not be needed in this case.
* In `FastISel` the `i64` return type was hard-coded, and as far as I could tell a `MVT` is needed for the result's value type.

Thinking about it a bit more, the constraint is only needed in case `anyregcc` is used, and for `FastISel` we could fail instruction selection and fall back to `SelectionDAG` if a single `MVT` cannot be created from the return type.

Let me know if this approach would be reasonable.

https://github.com/llvm/llvm-project/pull/85911


More information about the llvm-commits mailing list