From d2b212efb02799272d6ebb7e4fd0545f8c68dd6f Mon Sep 17 00:00:00 2001 From: Yifan Zhao <yifanz16@illinois.edu> Date: Sun, 19 Jan 2020 18:44:12 -0600 Subject: [PATCH] Completed the fix in 32b6188aa --- hpvm/lib/Transforms/DFG2LLVM_NVPTX/DFG2LLVM_NVPTX.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/hpvm/lib/Transforms/DFG2LLVM_NVPTX/DFG2LLVM_NVPTX.cpp b/hpvm/lib/Transforms/DFG2LLVM_NVPTX/DFG2LLVM_NVPTX.cpp index 02b4586046..e3c21133b3 100644 --- a/hpvm/lib/Transforms/DFG2LLVM_NVPTX/DFG2LLVM_NVPTX.cpp +++ b/hpvm/lib/Transforms/DFG2LLVM_NVPTX/DFG2LLVM_NVPTX.cpp @@ -1400,9 +1400,10 @@ void CGT_NVPTX::codeGen(DFLeafNode* N) { assert(Ptr->getType()->isPointerTy() && "First argument of supported atomics is expected to be a pointer"); PointerType* PtrTy = cast<PointerType>(Ptr->getType()); - - if(PtrTy != Type::getInt32PtrTy(II->getContext(), PtrTy->getAddressSpace())) { - Ptr = CastInst::CreatePointerCast(Ptr, Type::getInt32PtrTy(II->getContext(), PtrTy->getAddressSpace()), "", II); + PointerType* TargetTy = Type::getInt32PtrTy(II->getContext(), PtrTy->getAddressSpace()); + if (PtrTy != TargetTy) { + Ptr = CastInst::CreatePointerCast(Ptr, TargetTy, "", II); + PtrTy = TargetTy; } std::string name; -- GitLab