@@ -2,14 +2,14 @@ From 61af6af10d10a08b81d3924fa5b35bfb548b2a05 Mon Sep 17 00:00:00 2001
22From: nasmnc01 <
[email protected] >
33Author: Scott Douglass <
[email protected] >
44Date: Tue, 13 Aug 2024 10:55:51 +0100
5- Subject: [PATCH] [ARM][CodeGen] Disable MEMCPY LDM/STM inlining for v7-m
5+ Subject: [PATCH] [ARM][CodeGen] Prefer MEMCPY LDM/STM inlining for v7-m
66
7- This patch disables the expansion of MEMCPY to LDM/STM
8- on v7-m targets. This is due to a slowdown caused
9- by this inlining method.
7+ This patch changes the behaviour of memcpy inlining on v7m targets.
8+ The old behaviour was to inline memcpys with LDM/STM instructions.
9+ Alternatively, using LD/ST instructions for memcpy inlining allowed
10+ for performance gains of 1% to 2% on selected benchmarks.
1011
1112Co-authored-by: Nashe Mncube <
[email protected] >
12- Change-Id: I91095299c2c67670a16849d08540bdbc07a95adc
1313---
1414 llvm/lib/Target/ARM/ARMFeatures.td | 5 +
1515 llvm/lib/Target/ARM/ARMProcessors.td | 2 +-
@@ -188,7 +188,7 @@ index c57825949c1c..12db2ab1fca2 100644
188188 return EmitSpecializedLibcall(DAG, dl, Chain, Dst, Src, Size,
189189 Alignment.value(), RTLIB::MEMCPY);
190190
191- + if (Subtarget.allowInlineMemcpyAsLdSt() )
191+ + if (Subtarget.UseInlineMemcpyAsLdSt )
192192+ return EmitMemcpyAsLdSt(DAG, dl, Subtarget, Chain, Dst, Src, SizeVal,
193193+ isVolatile, DstPtrInfo, SrcPtrInfo);
194194+
@@ -212,19 +212,6 @@ index 275b1c0f8dc0..6ff422c15b12 100644
212212 SDValue
213213 EmitTargetCodeForMemmove(SelectionDAG &DAG, const SDLoc &dl, SDValue Chain,
214214 SDValue Dst, SDValue Src, SDValue Size,
215- diff --git a/llvm/lib/Target/ARM/ARMSubtarget.h b/llvm/lib/Target/ARM/ARMSubtarget.h
216- index 2f7af05a259f..0acf919b1360 100644
217- --- a/llvm/lib/Target/ARM/ARMSubtarget.h
218- +++ b/llvm/lib/Target/ARM/ARMSubtarget.h
219- @@ -523,6 +523,8 @@ public:
220- bool ignoreCSRForAllocationOrder(const MachineFunction &MF,
221- unsigned PhysReg) const override;
222- unsigned getGPRAllocationOrder(const MachineFunction &MF) const;
223- +
224- + bool allowInlineMemcpyAsLdSt() const { return UseInlineMemcpyAsLdSt; }
225- };
226-
227- } // end namespace llvm
228215- -
2292162.34.1
230217
0 commit comments