Index: include/llvm/CodeGen/PseudoSourceValue.h
===================================================================
--- include/llvm/CodeGen/PseudoSourceValue.h
+++ include/llvm/CodeGen/PseudoSourceValue.h
@@ -47,6 +47,7 @@
 
 private:
   PSVKind Kind;
+  unsigned AddressSpace;
   friend raw_ostream &llvm::operator<<(raw_ostream &OS,
                                        const PseudoSourceValue* PSV);
 
@@ -57,7 +58,7 @@
   virtual void printCustom(raw_ostream &O) const;
 
 public:
-  explicit PseudoSourceValue(PSVKind Kind);
+  explicit PseudoSourceValue(PSVKind Kind, unsigned AdressSpace = 0);
 
   virtual ~PseudoSourceValue();
 
@@ -68,6 +69,8 @@
   bool isConstantPool() const { return Kind == ConstantPool; }
   bool isJumpTable() const { return Kind == JumpTable; }
 
+  unsigned getAddressSpace() const { return AddressSpace; }
+
   /// Test whether the memory pointed to by this PseudoSourceValue has a
   /// constant value.
   virtual bool isConstant(const MachineFrameInfo *) const;
Index: lib/CodeGen/MachineInstr.cpp
===================================================================
--- lib/CodeGen/MachineInstr.cpp
+++ lib/CodeGen/MachineInstr.cpp
@@ -467,7 +467,11 @@
 /// getAddrSpace - Return the LLVM IR address space number that this pointer
 /// points into.
 unsigned MachinePointerInfo::getAddrSpace() const {
-  if (V.isNull() || V.is<const PseudoSourceValue*>()) return 0;
+  if (V.isNull()) return 0;
+
+  if (V.is<const PseudoSourceValue*>())
+    return V.get<const PseudoSourceValue*>()->getAddressSpace();
+
   return cast<PointerType>(V.get<const Value*>()->getType())->getAddressSpace();
 }
 
Index: lib/CodeGen/PseudoSourceValue.cpp
===================================================================
--- lib/CodeGen/PseudoSourceValue.cpp
+++ lib/CodeGen/PseudoSourceValue.cpp
@@ -24,7 +24,8 @@
     "Stack", "GOT", "JumpTable", "ConstantPool", "FixedStack",
     "GlobalValueCallEntry", "ExternalSymbolCallEntry"};
 
-PseudoSourceValue::PseudoSourceValue(PSVKind Kind) : Kind(Kind) {}
+PseudoSourceValue::PseudoSourceValue(PSVKind Kind, unsigned AddressSpace)
+    : Kind(Kind), AddressSpace(AddressSpace) {}
 
 PseudoSourceValue::~PseudoSourceValue() {}