diff --git a/llvm/lib/Transforms/DFG2LLVM_NVPTX/DFG2LLVM_NVPTX.cpp b/llvm/lib/Transforms/DFG2LLVM_NVPTX/DFG2LLVM_NVPTX.cpp
index 5f2e483cee789a63fc77d1e99723c77a530747ff..decf1b137f372ec98f1232863ccdd69345c27d37 100644
--- a/llvm/lib/Transforms/DFG2LLVM_NVPTX/DFG2LLVM_NVPTX.cpp
+++ b/llvm/lib/Transforms/DFG2LLVM_NVPTX/DFG2LLVM_NVPTX.cpp
@@ -1140,7 +1140,7 @@ void CGT_NVPTX::codeGen(DFLeafNode* N) {
       case Intrinsic::visc_getNodeInstanceID_x:
       case Intrinsic::visc_getNodeInstanceID_y:
       case Intrinsic::visc_getNodeInstanceID_z: {
-        DEBUG(errs() << F_nvptx->getName() << "\t: Handling getNodeInstanceID\n");
+        DEBUG(errs() << F_nvptx->getName() << "\t: Handling getNodeInstanceID\n" << "\t: " << *II << "\n");
         ArgII = cast<IntrinsicInst>((II->getOperand(0))->stripPointerCasts());
         ArgDFNode = Leaf_HandleToDFNodeMap[ArgII];
         assert(ArgDFNode && "Arg node is NULL");
@@ -1159,7 +1159,7 @@ void CGT_NVPTX::codeGen(DFLeafNode* N) {
         // Argument of the function to be called
         ConstantInt * DimConstant =
           ConstantInt::get(Type::getInt32Ty(getGlobalContext()) /*KernelM.getContext()*/ , dim);
-        ArrayRef<Value *> Args(DimConstant);
+        //ArrayRef<Value *> Args(DimConstant);
 
         // The following is to find which function to call
         Function * OpenCLFunction;
@@ -1183,6 +1183,7 @@ void CGT_NVPTX::codeGen(DFLeafNode* N) {
           OpenCLFunction = cast<Function>
                            (KernelM.getOrInsertFunction(StringRef("get_global_id"), FT));
         } else if (Leaf_HandleToDFNodeMap[ArgII] == N) {
+          //DEBUG(errs() << "Here inside cond 2\n");
           // We are asking for this node's id with respect to its parent
           // this is a local id call
           FunctionType* FT =
@@ -1191,6 +1192,7 @@ void CGT_NVPTX::codeGen(DFLeafNode* N) {
                               false);
           OpenCLFunction = cast<Function>
                            (KernelM.getOrInsertFunction(StringRef("get_local_id"), FT));
+          //DEBUG(errs() << "exiting condition 2\n");
         } else if (Leaf_HandleToDFNodeMap[ArgII] == N->getParent()) {
           // We are asking for this node's parent's id with respect to its
           // parent: this is a group id call
@@ -1208,9 +1210,15 @@ void CGT_NVPTX::codeGen(DFLeafNode* N) {
           assert(false && "Unable to translate getNodeInstanceID intrinsic");
         }
 
+        //DEBUG(errs() << "Create call instruction, insert it before the instrinsic\n");
+        //DEBUG(errs() << "Function: " << *OpenCLFunction << "\n");
+        //DEBUG(errs() << "Arguments size: " << Args.size() << "\n");
+        //DEBUG(errs() << "Argument: " << Args[0] << "\n");
+        //DEBUG(errs() << "Arguments: " << *DimConstant << "\n");
         // Create call instruction, insert it before the intrinsic and
         // replace the uses of the previous instruction with the new one
-        CallInst* CI = CallInst::Create(OpenCLFunction, Args, "", II);
+        CallInst* CI = CallInst::Create(OpenCLFunction, DimConstant, "", II);
+        //DEBUG(errs() << "Replace uses\n");
         II->replaceAllUsesWith(CI);
 
         IItoRemove.push_back(II);
@@ -1243,7 +1251,7 @@ void CGT_NVPTX::codeGen(DFLeafNode* N) {
         // Argument of the function to be called
         ConstantInt * DimConstant =
           ConstantInt::get(Type::getInt32Ty(getGlobalContext() /*KernelM.getContext()*/), dim);
-        ArrayRef<Value *> Args(DimConstant);
+        //ArrayRef<Value *> Args(DimConstant);
 
         // The following is to find which function to call
         Function * OpenCLFunction;
@@ -1276,7 +1284,7 @@ void CGT_NVPTX::codeGen(DFLeafNode* N) {
 
         // Create call instruction, insert it before the intrinsic and
         // replace the uses of the previous instruction with the new one
-        CallInst* CI = CallInst::Create(OpenCLFunction, Args, "", II);
+        CallInst* CI = CallInst::Create(OpenCLFunction, DimConstant, "", II);
         II->replaceAllUsesWith(CI);
 
         IItoRemove.push_back(II);
diff --git a/llvm/lib/Transforms/DFG2LLVM_SPIR/DFG2LLVM_SPIR.cpp b/llvm/lib/Transforms/DFG2LLVM_SPIR/DFG2LLVM_SPIR.cpp
index 32612a85c1cd69cbbd1fb67a7920da8571b480b8..e89e74478dc631bd55fa3dc3df7f7f01f80f760c 100644
--- a/llvm/lib/Transforms/DFG2LLVM_SPIR/DFG2LLVM_SPIR.cpp
+++ b/llvm/lib/Transforms/DFG2LLVM_SPIR/DFG2LLVM_SPIR.cpp
@@ -1186,7 +1186,7 @@ void CGT_SPIR::codeGen(DFLeafNode* N) {
         // Argument of the function to be called
         ConstantInt * DimConstant =
           ConstantInt::get(Type::getInt32Ty(getGlobalContext()) /*KernelM.getContext()*/ , dim);
-        ArrayRef<Value *> Args(DimConstant);
+        //ArrayRef<Value *> Args(DimConstant);
 
         // The following is to find which function to call
         Function * OpenCLFunction;
@@ -1231,7 +1231,7 @@ void CGT_SPIR::codeGen(DFLeafNode* N) {
         // Create call instruction, insert it before the intrinsic and truncate
         // the output to 32 bits and replace all the uses of the previous
         // instruction with the new one
-        CallInst* CI = CallInst::Create(OpenCLFunction, Args, "", II);
+        CallInst* CI = CallInst::Create(OpenCLFunction, DimConstant, "", II);
         TruncInst* TI = new TruncInst(CI, Type::getInt32Ty(getGlobalContext()), "", II); 
         II->replaceAllUsesWith(TI);
 
@@ -1265,7 +1265,7 @@ void CGT_SPIR::codeGen(DFLeafNode* N) {
         // Argument of the function to be called
         ConstantInt * DimConstant =
           ConstantInt::get(Type::getInt32Ty(getGlobalContext() /*KernelM.getContext()*/), dim);
-        ArrayRef<Value *> Args(DimConstant);
+        //ArrayRef<Value *> Args(DimConstant);
 
         // The following is to find which function to call
         Function * OpenCLFunction;
@@ -1299,7 +1299,7 @@ void CGT_SPIR::codeGen(DFLeafNode* N) {
         // Create call instruction, insert it before the intrinsic and truncate
         // the output to 32 bits and replace all the uses of the previous
         // instruction with the new one
-        CallInst* CI = CallInst::Create(OpenCLFunction, Args, "", II);
+        CallInst* CI = CallInst::Create(OpenCLFunction, DimConstant, "", II);
         TruncInst* TI = new TruncInst(CI, Type::getInt32Ty(getGlobalContext()), "", II); 
         II->replaceAllUsesWith(TI);