[llvm-branch-commits] [llvm] [IR] Introduce the `ptrtoaddr` instruction (PR #139357)

Alexander Richardson via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Fri Jun 20 15:49:45 PDT 2025


================
@@ -4274,6 +4274,7 @@ bool LLParser::parseValID(ValID &ID, PerFunctionState *PFS, Type *ExpectedTy) {
   case lltok::kw_bitcast:
   case lltok::kw_addrspacecast:
   case lltok::kw_inttoptr:
+  // ptrtoaddr not supported in constant exprs (yet?).
----------------
arichardson wrote:

I wasn't 100% certain we would need it since we could use a truncating `ptrtoint ptr addrspace(200) to i64/32` (ignoring provenance capture). This is a bit ugly, but since there are ongoing efforts to remove as many ConstantExprs as possible, adding a new one did not seem desirable.

How about a simple
`// TODO: We may need to support ptrtoaddr in constant exprs in the future.`

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


More information about the llvm-branch-commits mailing list