================ @@ -959,8 +959,12 @@ void CodeGenPGO::emitCounterIncrement(CGBuilderTy &Builder, const Stmt *S, unsigned Counter = (*RegionCounterMap)[S]; - llvm::Value *Args[] = {FuncNameVar, - Builder.getInt64(FunctionHash), + // Make sure that pointer to global is passed in with zero addrspace + // This is relevant during GPU profiling + auto *NormalizedPtr = llvm::ConstantExpr::getPointerBitCastOrAddrSpaceCast( + FuncNameVar, llvm::PointerType::getUnqual(CGM.getLLVMContext())); ---------------- EthanLuisMcDonough wrote:
`FuncNameVar` has an addrspace of 1 on GPU devices. The `instrprof_increment` throws a type error if you pass in a pointer without addrspace 0. Is there a reason why one should use `PointerType::get(ctx, 0)` over `PointerType::getUnqual`? Is the latter bad practice/being deprecated? https://github.com/llvm/llvm-project/pull/76587 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits