================ @@ -3532,6 +3533,28 @@ void Verifier::visitFPToSIInst(FPToSIInst &I) { visitInstruction(I); } +void Verifier::visitPtrToAddrInst(PtrToAddrInst &I) { + // Get the source and destination types + Type *SrcTy = I.getOperand(0)->getType(); + Type *DestTy = I.getType(); + + Check(SrcTy->isPtrOrPtrVectorTy(), "PtrToAddr source must be pointer", &I); + Check(DestTy->isIntOrIntVectorTy(), "PtrToAddr result must be integral", &I); + Check(SrcTy->isVectorTy() == DestTy->isVectorTy(), "PtrToAddr type mismatch", + &I); + + if (SrcTy->isVectorTy()) { + auto *VSrc = cast<VectorType>(SrcTy); + auto *VDest = cast<VectorType>(DestTy); + Check(VSrc->getElementCount() == VDest->getElementCount(), + "PtrToAddr vector width mismatch", &I); + } + + Type *AddrTy = DL.getAddressType(SrcTy); + Check(AddrTy == DestTy, "PtrToAddr result must be address width", &I); + visitInstruction(I); +} ---------------- nikic wrote:
We're missing verification for the constexpr variant. This is tricky because we basically have to walk the whole module to find all the referenced constant expressions. I'm okay with omitting it for now. https://github.com/llvm/llvm-project/pull/139357 _______________________________________________ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits