[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>.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@215682 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Juergen Ributzka 2014-08-14 23:29:49 +00:00
parent e1e7862f6e
commit 266ecacfaa
2 changed files with 14 additions and 1 deletions

View File

@ -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)

View File

@ -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
}