diff --git a/llvm/lib/Transforms/DFG2LLVM_NVPTX/DFG2LLVM_NVPTX.cpp b/llvm/lib/Transforms/DFG2LLVM_NVPTX/DFG2LLVM_NVPTX.cpp
index f3a32a98280805d2835cb8e0dd1e2b91f2c8878e..768742b53e4ad9628e040147b80a0cd039269674 100644
--- a/llvm/lib/Transforms/DFG2LLVM_NVPTX/DFG2LLVM_NVPTX.cpp
+++ b/llvm/lib/Transforms/DFG2LLVM_NVPTX/DFG2LLVM_NVPTX.cpp
@@ -233,6 +233,7 @@ public:
     changeDataLayout(KernelM);
     changeTargetTriple(KernelM);
 
+
     DEBUG(errs() << KernelM);
 
   }
@@ -958,6 +959,8 @@ void CGT_NVPTX::codeGen(DFLeafNode* N) {
 
     F_nvptx = CloneFunction(F, VMap, true);
 
+
+
     // Insert the cloned function into the kernels module
     KernelM.getFunctionList().push_back(F_nvptx);
 
@@ -972,8 +975,13 @@ void CGT_NVPTX::codeGen(DFLeafNode* N) {
   } else {
     errs() << "WARNING: Visiting a node for which code already generated!\n";
   }
-  
+ 
+  // Transform  the function to void and remove all target dependent attributes
+  // from the function
   transformFunctionToVoid(F_nvptx);
+  DEBUG(errs() << "Removing all attributes from Kernel Function and adding nounwind\n");
+  F_nvptx->removeAttributes(AttributeSet::FunctionIndex, F_nvptx->getAttributes().getFnAttributes());
+  F_nvptx->addAttribute(AttributeSet::FunctionIndex, Attribute::NoUnwind);
 
   //FIXME: For now, assume only one allocation node
   kernel->AllocationNode = NULL;
@@ -1348,7 +1356,7 @@ void CGT_NVPTX::codeGen(DFLeafNode* N) {
       }
       break;
       default:
-        assert(false && "Unknown VISC Intrinsic!");
+        llvm_unreachable("Unknown VISC Intrinsic!");
         break;
       }