diff --git a/include/llvm/Support/MemoryBuffer.h b/include/llvm/Support/MemoryBuffer.h
index 81616d8..c59d5aa 100644
--- a/include/llvm/Support/MemoryBuffer.h
+++ b/include/llvm/Support/MemoryBuffer.h
@@ -151,6 +151,8 @@ class MemoryBufferRef {
 
 public:
   MemoryBufferRef() {}
+  MemoryBufferRef(MemoryBuffer& Buffer)
+      : Buffer(Buffer.getBuffer()), Identifier(Buffer.getBufferIdentifier()) {}
   MemoryBufferRef(StringRef Buffer, StringRef Identifier)
       : Buffer(Buffer), Identifier(Identifier) {}
 
diff --git a/unittests/Support/MemoryBufferTest.cpp b/unittests/Support/MemoryBufferTest.cpp
index ffb809a..ffbd74d 100644
--- a/unittests/Support/MemoryBufferTest.cpp
+++ b/unittests/Support/MemoryBufferTest.cpp
@@ -170,6 +170,15 @@ TEST_F(MemoryBufferTest, getOpenFileReopened) {
 }
 
 
+TEST_F(MemoryBufferTest, reference) {
+  OwningBuffer MB(MemoryBuffer::getMemBuffer(data));
+  MemoryBufferRef MBR(*MB);
+
+  EXPECT_EQ(MB->getBufferStart(), MBR.getBufferStart());
+  EXPECT_EQ(MB->getBufferIdentifier(), MBR.getBufferIdentifier());
+}
+
+
 TEST_F(MemoryBufferTest, slice) {
   // Create a file that is six pages long with different data on each page.
   int FD;
