[llvm] r215682 - [FastISel][ARM] Fall-back to constant pool loads when	materializing an i32 constant.
    Juergen Ributzka 
    juergen at apple.com
       
    Thu Aug 14 16:29:49 PDT 2014
    
    
  
Author: ributzka
Date: Thu Aug 14 18:29:49 2014
New Revision: 215682
URL: http://llvm.org/viewvc/llvm-project?rev=215682&view=rev
Log:
[FastISel][ARM] Fall-back to constant pool loads when materializing an i32 constant.
FastEmit_i won't always succeed to materialize an i32 constant and just fail.
This would trigger a fall-back to SelectionDAG, which is really not necessary.
This fix will first fall-back to a constant pool load to materialize the constant
before giving up for good.
This fixes <rdar://problem/18022633>.
Modified:
    llvm/trunk/lib/Target/ARM/ARMFastISel.cpp
    llvm/trunk/test/CodeGen/ARM/fast-isel-mvn.ll
Modified: llvm/trunk/lib/Target/ARM/ARMFastISel.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMFastISel.cpp?rev=215682&r1=215681&r2=215682&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM/ARMFastISel.cpp (original)
+++ llvm/trunk/lib/Target/ARM/ARMFastISel.cpp Thu Aug 14 18:29:49 2014
@@ -547,7 +547,8 @@ unsigned ARMFastISel::ARMMaterializeInt(
   }
 
   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)
Modified: llvm/trunk/test/CodeGen/ARM/fast-isel-mvn.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/ARM/fast-isel-mvn.ll?rev=215682&r1=215681&r2=215682&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/ARM/fast-isel-mvn.ll (original)
+++ llvm/trunk/test/CodeGen/ARM/fast-isel-mvn.ll Thu Aug 14 18:29:49 2014
@@ -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
+}
+
    
    
More information about the llvm-commits
mailing list