mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-19 18:24:00 +00:00
When passing a huge parameter using the byval mechanism, a long
sequence of loads and stores was being generated to perform the copy on the x86 targets if the parameter was less than 4 byte aligned, causing llc to use up vast amounts of memory and time. Use a "rep movs" form instead. PR7170. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118260 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -187,19 +187,29 @@ X86SelectionDAGInfo::EmitTargetCodeForMemcpy(SelectionDAG &DAG, DebugLoc dl,
|
|||||||
if (!AlwaysInline && SizeVal > Subtarget->getMaxInlineSizeThreshold())
|
if (!AlwaysInline && SizeVal > Subtarget->getMaxInlineSizeThreshold())
|
||||||
return SDValue();
|
return SDValue();
|
||||||
|
|
||||||
/// If not DWORD aligned, call the library.
|
/// If not DWORD aligned, it is more efficient to call the library. However
|
||||||
if ((Align & 3) != 0)
|
/// if calling the library is not allowed (AlwaysInline), then soldier on as
|
||||||
|
/// the code generated here is better than the long load-store sequence we
|
||||||
|
/// would otherwise get.
|
||||||
|
if (!AlwaysInline && (Align & 3) != 0)
|
||||||
return SDValue();
|
return SDValue();
|
||||||
|
|
||||||
// If to a segment-relative address space, use the default lowering.
|
// If to a segment-relative address space, use the default lowering.
|
||||||
if (DstPtrInfo.getAddrSpace() >= 256 ||
|
if (DstPtrInfo.getAddrSpace() >= 256 ||
|
||||||
SrcPtrInfo.getAddrSpace() >= 256)
|
SrcPtrInfo.getAddrSpace() >= 256)
|
||||||
return SDValue();
|
return SDValue();
|
||||||
|
|
||||||
// DWORD aligned
|
MVT AVT;
|
||||||
EVT AVT = MVT::i32;
|
if (Align & 1)
|
||||||
if (Subtarget->is64Bit() && ((Align & 0x7) == 0)) // QWORD aligned
|
AVT = MVT::i8;
|
||||||
AVT = MVT::i64;
|
else if (Align & 2)
|
||||||
|
AVT = MVT::i16;
|
||||||
|
else if (Align & 4)
|
||||||
|
// DWORD aligned
|
||||||
|
AVT = MVT::i32;
|
||||||
|
else
|
||||||
|
// QWORD aligned
|
||||||
|
AVT = Subtarget->is64Bit() ? MVT::i64 : MVT::i32;
|
||||||
|
|
||||||
unsigned UBytes = AVT.getSizeInBits() / 8;
|
unsigned UBytes = AVT.getSizeInBits() / 8;
|
||||||
unsigned CountVal = SizeVal / UBytes;
|
unsigned CountVal = SizeVal / UBytes;
|
||||||
|
11
test/CodeGen/Generic/2010-11-04-BigByval.ll
Normal file
11
test/CodeGen/Generic/2010-11-04-BigByval.ll
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
; RUN: llc < %s
|
||||||
|
; PR7170
|
||||||
|
|
||||||
|
%big = type [131072 x i8]
|
||||||
|
|
||||||
|
declare void @foo(%big* byval align 1)
|
||||||
|
|
||||||
|
define void @bar(%big* byval align 1 %x) {
|
||||||
|
call void @foo(%big* byval align 1 %x)
|
||||||
|
ret void
|
||||||
|
}
|
Reference in New Issue
Block a user