From a28e444858501671eb11bb16ba97626bcff0a3de Mon Sep 17 00:00:00 2001 From: Martin Fink Date: Thu, 28 Dec 2023 13:30:30 +0000 Subject: [PATCH] Fix ptrtoint --- clang/lib/CodeGen/CGBuiltin.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/clang/lib/CodeGen/CGBuiltin.cpp b/clang/lib/CodeGen/CGBuiltin.cpp index a659456649e52b..9bd17fed36d9fb 100644 --- a/clang/lib/CodeGen/CGBuiltin.cpp +++ b/clang/lib/CodeGen/CGBuiltin.cpp @@ -19870,8 +19870,8 @@ Value *CodeGenFunction::EmitWebAssemblyBuiltinExpr(unsigned BuiltinID, llvm::Type *IntTy = llvm::Type::getInt64Ty(Builder.getContext()); Value *Ptr = EmitScalarExpr(E->getArg(0)); Value *Tag = EmitScalarExpr(E->getArg(1)); - Value *IntPtr = Builder.CreateIntToPtr(Ptr, IntTy); - Value *IntTag = Builder.CreateIntToPtr(Tag, IntTy); + Value *IntPtr = Builder.CreatePtrToInt(Ptr, IntTy); + Value *IntTag = Builder.CreatePtrToInt(Tag, IntTy); Value *BitMask = llvm::ConstantInt::get(IntTy, 0x0000'FFFF'FFFF'FFFF, false); Value *BitMaskTag = llvm::ConstantInt::get(IntTy, 0xFFFF'0000'0000'0000, false); IntTag = Builder.CreateBinOp(llvm::Instruction::BinaryOps::And, IntTag, BitMaskTag);