[llvm] r261050 - [WebAssembly] Call memcpy for large byval copies.
Dan Gohman via llvm-commits
llvm-commits at lists.llvm.org
Tue Feb 16 17:43:38 PST 2016
Author: djg
Date: Tue Feb 16 19:43:37 2016
New Revision: 261050
URL: http://llvm.org/viewvc/llvm-project?rev=261050&view=rev
Log:
[WebAssembly] Call memcpy for large byval copies.
This fixes very slow compilation on
test/CodeGen/Generic/2010-11-04-BigByval.ll . Note that MaxStoresPerMemcpy
and friends are not yet carefully tuned so the cutoff point is currently
somewhat arbitrary. However, it's important that there be a cutoff point
so that we don't emit unbounded quantities of loads and stores.
Modified:
llvm/trunk/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp
llvm/trunk/test/CodeGen/WebAssembly/byval.ll
Modified: llvm/trunk/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp?rev=261050&r1=261049&r2=261050&view=diff
==============================================================================
--- llvm/trunk/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp (original)
+++ llvm/trunk/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp Tue Feb 16 19:43:37 2016
@@ -321,7 +321,7 @@ SDValue WebAssemblyTargetLowering::Lower
SDValue FINode = DAG.getFrameIndex(FI, getPointerTy(Layout));
Chain = DAG.getMemcpy(
Chain, DL, FINode, OutVal, SizeNode, Out.Flags.getByValAlign(),
- /*isVolatile*/ false, /*AlwaysInline=*/true,
+ /*isVolatile*/ false, /*AlwaysInline=*/false,
/*isTailCall*/ false, MachinePointerInfo(), MachinePointerInfo());
OutVal = FINode;
}
Modified: llvm/trunk/test/CodeGen/WebAssembly/byval.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/WebAssembly/byval.ll?rev=261050&r1=261049&r2=261050&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/WebAssembly/byval.ll (original)
+++ llvm/trunk/test/CodeGen/WebAssembly/byval.ll Tue Feb 16 19:43:37 2016
@@ -81,23 +81,6 @@ define void @byval_arg_double(%AlignedSt
ret void
}
-; CHECK-LABEL: byval_arg_big
-define void @byval_arg_big(%BigArray* %ptr) {
- ; CHECK: .param i32
- ; Subtract 48 from SP (SP is 16-byte aligned)
- ; CHECK: i32.const [[L2:.+]]=, 48
- ; CHECK-NEXT: i32.sub [[SP:.+]]=, {{.+}}, [[L2]]
- ; Copy the AlignedStruct argument to the stack (SP+12, original SP-36)
- ; CHECK: i64.load $push[[L4:.+]]=, 0($0):p2align=0
- ; CHECK: i64.store {{.*}}=, 12([[SP]]):p2align=2, $pop[[L4]]
- ; Pass a pointer to the stack slot to the function
- ; CHECK-NEXT: i32.const [[L5:.+]]=, 12
- ; CHECK-NEXT: i32.add [[ARG:.+]]=, [[SP]], [[L5]]
- ; CHECK-NEXT: call ext_byval_func_bigarray at FUNCTION, [[ARG]]
- call void @ext_byval_func_bigarray(%BigArray* byval %ptr)
- ret void
-}
-
; CHECK-LABEL: byval_param
define void @byval_param(%SmallStruct* byval align 32 %ptr) {
; CHECK: .param i32
@@ -122,3 +105,17 @@ define void @byval_empty_callee(%EmptySt
call void @ext_func_empty(%EmptyStruct* %ptr)
ret void
}
+
+; Call memcpy for "big" byvals.
+; TODO: When the prolog/epilog sequences are optimized, refine these checks to
+; be more specific.
+
+; CHECK-LABEL: big_byval:
+; CHECK: i32.call ${{[^,]+}}=, memcpy at FUNCTION,
+; CHECK-NEXT: call big_byval_callee at FUNCTION,
+%big = type [131072 x i8]
+declare void @big_byval_callee(%big* byval align 1)
+define void @big_byval(%big* byval align 1 %x) {
+ call void @big_byval_callee(%big* byval align 1 %x)
+ ret void
+}
More information about the llvm-commits
mailing list