diff --git a/llvm/include/llvm/IR/IntrinsicsVISC.td b/llvm/include/llvm/IR/IntrinsicsVISC.td
index 2dcd8a2f334df937e809a5e6097281d21245afc9..7f56304384adbe064716e069167f7b278a304db2 100644
--- a/llvm/include/llvm/IR/IntrinsicsVISC.td
+++ b/llvm/include/llvm/IR/IntrinsicsVISC.td
@@ -174,4 +174,7 @@ let TargetPrefix = "visc" in {
    */
   def int_visc_getVectorLength : Intrinsic<[llvm_i32_ty], [], []>;
 
+  /* ============ Atomic intrinsics ============= */
+
+
 }
diff --git a/llvm/lib/Transforms/DFG2LLVM_NVPTX/DFG2LLVM_NVPTX.cpp b/llvm/lib/Transforms/DFG2LLVM_NVPTX/DFG2LLVM_NVPTX.cpp
index fa99523df43dec18599e779370f2adea7b152daf..942b79f6861921e7aee6a637b5b6ed3b70948322 100644
--- a/llvm/lib/Transforms/DFG2LLVM_NVPTX/DFG2LLVM_NVPTX.cpp
+++ b/llvm/lib/Transforms/DFG2LLVM_NVPTX/DFG2LLVM_NVPTX.cpp
@@ -954,7 +954,7 @@ void CGT_NVPTX::codeGen(DFLeafNode* N) {
     assert(!BuildDFG::isViscLaunchIntrinsic(I) && "Launch intrinsic within a dataflow graph!");
     assert(!BuildDFG::isViscGraphIntrinsic(I) && "VISC graph intrinsic within a leaf dataflow node!");
 
-    if (BuildDFG::isViscQueryIntrinsic(I)) {
+    if (BuildDFG::isViscIntrinsic(I)) {
       IntrinsicInst* II = dyn_cast<IntrinsicInst>(I);
       IntrinsicInst* ArgII;
       DFNode* ArgDFNode;
@@ -1159,6 +1159,25 @@ void CGT_NVPTX::codeGen(DFLeafNode* N) {
         IItoRemove.push_back(II);
       }
       break;
+      case Intrinsic::visc_barrier:
+      {
+        errs() << F_nvptx->getName() << "\t: Handling barrier\n";
+        errs() << "Substitute with barrier()\n";
+        errs() << *II << "\n";
+          FunctionType* FT =
+            FunctionType::get(Type::getVoidTy(getGlobalContext() /*KernelM.getContext()*/),
+                              std::vector<Type*>(1, Type::getInt32Ty(getGlobalContext() /*KernelM.getContext()*/)),
+                              false);
+          Function* OpenCLFunction = cast<Function>
+                           (KernelM.getOrInsertFunction(StringRef("barrier"), FT));
+        CallInst* CI = CallInst::Create(OpenCLFunction,
+                               ArrayRef<Value*>(ConstantInt::get(Type::getInt32Ty(getGlobalContext()), 1)),
+                               "", II);
+        II->replaceAllUsesWith(CI);
+        IItoRemove.push_back(II);
+       
+      }
+      break;
       default:
         assert(false && "Unknown VISC Intrinsic!");
         break;