diff --git a/lib/Target/ARM/ARMFastISel.cpp b/lib/Target/ARM/ARMFastISel.cpp
index 5cb6d9a0a77..a6c51982bd1 100644
--- a/lib/Target/ARM/ARMFastISel.cpp
+++ b/lib/Target/ARM/ARMFastISel.cpp
@@ -547,7 +547,8 @@ unsigned ARMFastISel::ARMMaterializeInt(const Constant *C, MVT VT) {
   }
 
   if (Subtarget->useMovt(*FuncInfo.MF))
-    return FastEmit_i(VT, VT, ISD::Constant, CI->getZExtValue());
+    if (FastEmit_i(VT, VT, ISD::Constant, CI->getZExtValue()))
+      return true;
 
   // Load from constant pool.  For now 32-bit only.
   if (VT != MVT::i32)
diff --git a/test/CodeGen/ARM/fast-isel-mvn.ll b/test/CodeGen/ARM/fast-isel-mvn.ll
index 9cb56ea9ae1..c9c32880cce 100644
--- a/test/CodeGen/ARM/fast-isel-mvn.ll
+++ b/test/CodeGen/ARM/fast-isel-mvn.ll
@@ -106,3 +106,15 @@ entry:
   call void @foo(i32 -2130706433)
   ret void
 }
+
+; Load from constant pool.
+define i32 @t10(i32 %a) {
+; ARM-LABEL:   t10
+; ARM:         ldr
+; THUMB-LABEL: t10
+; THUMB:       movw r1, #52257
+; THUMB-NEXT:  movt r1, #35037
+  %1 = xor i32 -1998730207, %a
+  ret i32 %1
+}
+