Add target preference for GatherAllAliases max depth
authorMatt Arsenault <Matthew.Arsenault@amd.com>
Wed, 11 Nov 2015 18:44:33 +0000 (18:44 +0000)
committerMatt Arsenault <Matthew.Arsenault@amd.com>
Wed, 11 Nov 2015 18:44:33 +0000 (18:44 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252775 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/Target/TargetLowering.h
lib/CodeGen/SelectionDAG/DAGCombiner.cpp
lib/CodeGen/TargetLoweringBase.cpp

index d1770968d43fe8ff42e9d144d8fccf9216eb8cb6..cb5a5796e9833806bce7b64c0aac394bb4fbe3f0 100644 (file)
@@ -833,6 +833,10 @@ public:
     return TargetDAGCombineArray[NT >> 3] & (1 << (NT&7));
   }
 
+  unsigned getGatherAllAliasesMaxDepth() const {
+    return GatherAllAliasesMaxDepth;
+  }
+
   /// \brief Get maximum # of store operations permitted for llvm.memset
   ///
   /// This function returns the maximum number of store operations permitted
@@ -1946,6 +1950,12 @@ protected:
   ///      is[Z|FP]ExtFree of the related types is not true.
   virtual bool isExtFreeImpl(const Instruction *I) const { return false; }
 
+  /// Depth that GatherAllAliases should should continue looking for chain
+  /// dependencies when trying to find a more preferrable chain. As an
+  /// approximation, this should be more than the number of consecutive stores
+  /// expected to be merged.
+  unsigned GatherAllAliasesMaxDepth;
+
   /// \brief Specify maximum number of store instructions per memset call.
   ///
   /// When lowering \@llvm.memset this field specifies the maximum number of
index 2dd71bd4e7fe1b59cbe9776bd1868291e958d91f..a1edb29e4860ba3605791d7bacf5429f857a2ca8 100644 (file)
@@ -14455,7 +14455,7 @@ void DAGCombiner::GatherAllAliases(SDNode *N, SDValue OriginalChain,
     // FIXME: The depth check could be made to return the last non-aliasing
     // chain we found before we hit a tokenfactor rather than the original
     // chain.
-    if (Depth > 6) {
+    if (Depth > TLI.getGatherAllAliasesMaxDepth()) {
       Aliases.clear();
       Aliases.push_back(OriginalChain);
       return;
index 69eec888745a07cd85f80495f665a44ec56ec4c9..45c6c9e4b2a58aaad454f4de61182fb4a5944a3e 100644 (file)
@@ -774,6 +774,7 @@ TargetLoweringBase::TargetLoweringBase(const TargetMachine &tm) : TM(tm) {
   MinFunctionAlignment = 0;
   PrefFunctionAlignment = 0;
   PrefLoopAlignment = 0;
+  GatherAllAliasesMaxDepth = 6;
   MinStackArgumentAlignment = 1;
   InsertFencesForAtomic = false;
   MinimumJumpTableEntries = 4;