[llvm] [SPIR-V] Add lowering of ptrtoaddr (PR #184577)
Juan Manuel Martinez CaamaƱo via llvm-commits
llvm-commits at lists.llvm.org
Wed Mar 4 04:47:08 PST 2026
================
@@ -1725,6 +1726,16 @@ Instruction *SPIRVEmitIntrinsics::visitBitCastInst(BitCastInst &I) {
return NewI;
}
+Instruction *SPIRVEmitIntrinsics::visitPtrToAddrInst(PtrToAddrInst &I) {
+ // Replace PtrToAddr with PtrToInt.
+ auto *PtrToInt =
+ CastInst::Create(Instruction::PtrToInt, I.getOperand(0), I.getType());
+ PtrToInt->insertBefore(I.getIterator());
+ replaceAllUsesWith(&I, PtrToInt);
+ I.eraseFromParent();
----------------
jmmartinez wrote:
>From `BasicBlockUtils.h`
```suggestion
ReplaceInstWithInst(I, PtrToInt);
```
This function also copies the debug-location.
https://github.com/llvm/llvm-project/pull/184577
More information about the llvm-commits
mailing list