Index: test/CodeGenOpenCL/inline-call.cl
===================================================================
--- test/CodeGenOpenCL/inline-call.cl	(revision 0)
+++ test/CodeGenOpenCL/inline-call.cl	(revision 0)
@@ -0,0 +1,14 @@
+// RUN: %clang_cc1 %s -emit-llvm -O0 -o - | FileCheck %s
+
+inline int bar(int X) {
+  if (X < 100)
+    return 543;
+  else
+    return X;
+}
+
+// CHECK: define internal fastcc i32 @bar(i32 %X) nounwind readnone inlinehint
+
+kernel void foo(int *Y) {
+*Y = bar(*Y);
+}
Index: lib/AST/Decl.cpp
===================================================================
--- lib/AST/Decl.cpp	(revision 158365)
+++ lib/AST/Decl.cpp	(working copy)
@@ -363,6 +363,14 @@
       }
     }
 
+    // In OpenCL, all functions declared "inline" have internal linkage
+    // if the storage class is unspecified.
+    if (Context.getLangOpts().OpenCL &&
+        Function->isInlineSpecified() &&
+        Function->getStorageClass() == SC_None) {
+      return LinkageInfo::internal();
+    }
+    
     // In C++, then if the type of the function uses a type with
     // unique-external linkage, it's not legally usable from outside
     // this translation unit.  However, we should use the C linkage
