diff options
| author | Amara Emerson <aemerson@apple.com> | 2019-07-24 22:17:31 +0000 |
|---|---|---|
| committer | Amara Emerson <aemerson@apple.com> | 2019-07-24 22:17:31 +0000 |
| commit | 13af1ed8e37c3f53b4dbd03f7c40b069d4895087 (patch) | |
| tree | 2b005088e9b02aa4743ac52ce5b94cf34a99c6ab /llvm/lib/Target/AArch64/AArch64PreLegalizerCombiner.cpp | |
| parent | eb6782758a54f200a1a5e531bef28192833d2584 (diff) | |
| download | bcm5719-llvm-13af1ed8e37c3f53b4dbd03f7c40b069d4895087.tar.gz bcm5719-llvm-13af1ed8e37c3f53b4dbd03f7c40b069d4895087.zip | |
[GlobalISel] Support for inlining memcpy, memset and memmove calls.
This introduces a new family of combiner helper routines that re-use the
target specific cost model from SelectionDAG, and generate inline implementations
of the memcpy family of intrinsics.
The combines are only enabled at optimization levels higher than -O0, and give
very substantial performance improvements.
Differential Revision: https://reviews.llvm.org/D65167
llvm-svn: 366951
Diffstat (limited to 'llvm/lib/Target/AArch64/AArch64PreLegalizerCombiner.cpp')
| -rw-r--r-- | llvm/lib/Target/AArch64/AArch64PreLegalizerCombiner.cpp | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/llvm/lib/Target/AArch64/AArch64PreLegalizerCombiner.cpp b/llvm/lib/Target/AArch64/AArch64PreLegalizerCombiner.cpp index 5f7245bfbd7..5ec209ada17 100644 --- a/llvm/lib/Target/AArch64/AArch64PreLegalizerCombiner.cpp +++ b/llvm/lib/Target/AArch64/AArch64PreLegalizerCombiner.cpp @@ -28,9 +28,9 @@ using namespace MIPatternMatch; namespace { class AArch64PreLegalizerCombinerInfo : public CombinerInfo { public: - AArch64PreLegalizerCombinerInfo() + AArch64PreLegalizerCombinerInfo(bool EnableOpt, bool OptSize, bool MinSize) : CombinerInfo(/*AllowIllegalOps*/ true, /*ShouldLegalizeIllegal*/ false, - /*LegalizerInfo*/ nullptr) {} + /*LegalizerInfo*/ nullptr, EnableOpt, OptSize, MinSize) {} virtual bool combine(GISelChangeObserver &Observer, MachineInstr &MI, MachineIRBuilder &B) const override; }; @@ -51,6 +51,18 @@ bool AArch64PreLegalizerCombinerInfo::combine(GISelChangeObserver &Observer, case TargetOpcode::G_SEXTLOAD: case TargetOpcode::G_ZEXTLOAD: return Helper.tryCombineExtendingLoads(MI); + case TargetOpcode::G_INTRINSIC_W_SIDE_EFFECTS: + switch (MI.getIntrinsicID()) { + case Intrinsic::memcpy: + case Intrinsic::memmove: + case Intrinsic::memset: { + // Try to inline memcpy type calls if optimizations are enabled. + return (EnableOpt && !EnableOptSize) ? Helper.tryCombineMemCpyFamily(MI) + : false; + } + default: + break; + } } return false; @@ -89,7 +101,11 @@ bool AArch64PreLegalizerCombiner::runOnMachineFunction(MachineFunction &MF) { MachineFunctionProperties::Property::FailedISel)) return false; auto *TPC = &getAnalysis<TargetPassConfig>(); - AArch64PreLegalizerCombinerInfo PCInfo; + const Function &F = MF.getFunction(); + bool EnableOpt = + MF.getTarget().getOptLevel() != CodeGenOpt::None && !skipFunction(F); + AArch64PreLegalizerCombinerInfo PCInfo(EnableOpt, F.hasOptSize(), + F.hasMinSize()); Combiner C(PCInfo, TPC); return C.combineMachineInstrs(MF, /*CSEInfo*/ nullptr); } |

