summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/X86/X86ISelLowering.h
diff options
context:
space:
mode:
authorSanjay Patel <spatel@rotateright.com>2017-09-16 13:29:12 +0000
committerSanjay Patel <spatel@rotateright.com>2017-09-16 13:29:12 +0000
commit65d67807039df6a6b5e879fcf4686493680a4812 (patch)
tree5007a001db4d1686f4952ad4cf32a6e8cc56e574 /llvm/lib/Target/X86/X86ISelLowering.h
parent053417946fad2941dc5c8cd7af0b5002e0066cae (diff)
downloadbcm5719-llvm-65d67807039df6a6b5e879fcf4686493680a4812.tar.gz
bcm5719-llvm-65d67807039df6a6b5e879fcf4686493680a4812.zip
[x86] enable storeOfVectorConstantIsCheap() target hook
This allows vector-sized store merging of constants in DAGCombiner using the existing code in MergeConsecutiveStores(). All of the twisted logic that decides exactly what vector operations are legal and fast for each particular CPU are handled separately in there using the appropriate hooks. For the motivating tests in merge-store-constants.ll, we already produce the same vector code in IR via the SLP vectorizer. So this is just providing a backend backstop for code that doesn't go through that pass (-O1). More details in PR24449: https://bugs.llvm.org/show_bug.cgi?id=24449 (this change should be the last step to resolve that bug) Differential Revision: https://reviews.llvm.org/D37451 llvm-svn: 313458
Diffstat (limited to 'llvm/lib/Target/X86/X86ISelLowering.h')
-rw-r--r--llvm/lib/Target/X86/X86ISelLowering.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/llvm/lib/Target/X86/X86ISelLowering.h b/llvm/lib/Target/X86/X86ISelLowering.h
index 251d6ec435b..71caa562eec 100644
--- a/llvm/lib/Target/X86/X86ISelLowering.h
+++ b/llvm/lib/Target/X86/X86ISelLowering.h
@@ -1037,6 +1037,13 @@ namespace llvm {
bool isExtractSubvectorCheap(EVT ResVT, EVT SrcVT,
unsigned Index) const override;
+ bool storeOfVectorConstantIsCheap(EVT MemVT, unsigned NumElem,
+ unsigned AddrSpace) const override {
+ // If we can replace more than 2 scalar stores, there will be a reduction
+ // in instructions even after we add a vector constant load.
+ return NumElem > 2;
+ }
+
/// Intel processors have a unified instruction and data cache
const char * getClearCacheBuiltinName() const override {
return nullptr; // nothing to do, move along.
OpenPOWER on IntegriCloud