[llvm] [SPIR-V][Codegen] Represent the property of the target to declare and use typed pointers and update MachineVerifier to use it (PR #110270)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 30 10:12:52 PDT 2024


arsenm wrote:

> I can't say that I agree with (or maybe understand the reason for) the implemented machine verification of G_BITCAST arguments, because it voluntarily restricts `bitcast` definition in LLVM IR (https://llvm.org/docs/LangRef.html#i-bitcast): "If the source type is a pointer, the destination type must also be a pointer of the same size", and changes its behavior wrt. address spaces: "Pointer ... types may only be converted to other pointer ... types with the same address space ...".
> 

Having G_BITCAST have different rules than the IR bitcast is an oddity we could relax. The IR permits no-op bitcasts. The IR also does not allow bitcasts between pointers with different address spaces ([although it should](https://discourse.llvm.org/t/rfc-llvm-ir-should-allow-bitcast-between-address-spaces-with-the-same-size/5759).) So we could just remove this verifier check, but I don't understand why you would want this. A no-op bitcast conveys no information you could use.

Do you have sample IR and MIR with more context? 

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


More information about the llvm-commits mailing list