[llvm] [SPIRV] Handle `inttoptr` constant expressions in global initialisers (PR #166494)
Alex Voicu via llvm-commits
llvm-commits at lists.llvm.org
Wed Nov 5 08:55:16 PST 2025
================
@@ -348,6 +348,15 @@ static SPIRVType *propagateSPIRVType(MachineInstr *MI, SPIRVGlobalRegistry *GR,
SpvType = GR->getOrCreateSPIRVIntegerType(
MRI.getType(Reg).getScalarSizeInBits(), MIB);
break;
+ case TargetOpcode::G_INTTOPTR:
+ // With opaque pointers it doesn't appear as if we can convert to
----------------
AlexVlx wrote:
I don't think `assign.ptr.type` works for global values / quantities, as the assumption is that globals are already typeful. Hence the need to give this a type - in some sense it is symmetric with the `ptrtoint` above. There isn't enough context to infer any type other than `void*` at this point (these'd essentially be `ConstantExpr`s) - the only operator that'd carry extra type info might be GEP, but it's not immediately apparent how we'd have an `inttoptr` followed by `gep` sequence. Apologies if I misunderstood the gist of the question / suggestion or if I'm missing something obvious.
https://github.com/llvm/llvm-project/pull/166494
More information about the llvm-commits
mailing list