Remove isProfitableToDuplicateIndirectBranch target hook. It is profitable
authorBob Wilson <bob.wilson@apple.com>
Mon, 30 Nov 2009 18:35:03 +0000 (18:35 +0000)
committerBob Wilson <bob.wilson@apple.com>
Mon, 30 Nov 2009 18:35:03 +0000 (18:35 +0000)
for all the processors where I have tried it, and even when it might not help
performance, the cost is quite low.  The opportunities for duplicating
indirect branches are limited by other factors so code size does not change
much due to tail duplicating indirect branches aggressively.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@90144 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/Target/TargetInstrInfo.h
lib/CodeGen/TailDuplication.cpp
lib/Target/ARM/ARMBaseInstrInfo.cpp
lib/Target/ARM/ARMBaseInstrInfo.h
lib/Target/ARM/ARMSubtarget.cpp
lib/Target/ARM/ARMSubtarget.h
lib/Target/PowerPC/PPCInstrInfo.h
lib/Target/X86/X86InstrInfo.h

index 8070d458588d0da878c184b32135c8e01f76663d..1ba6b2f299924a549705fa7eb0a4474394d56e5b 100644 (file)
@@ -543,10 +543,6 @@ public:
   /// length.
   virtual unsigned getInlineAsmLength(const char *Str,
                                       const MCAsmInfo &MAI) const;
-
-  /// isProfitableToDuplicateIndirectBranch - Returns true if tail duplication
-  /// is especially profitable for indirect branches.
-  virtual bool isProfitableToDuplicateIndirectBranch() const { return false; }
 };
 
 /// TargetInstrInfoImpl - This is the default implementation of
index 12610b027185bf1df86e578af4fa061789135426..68fa2099c814f02350d7561ebe7cc48765cdcf80 100644 (file)
@@ -118,8 +118,7 @@ bool TailDuplicatePass::TailDuplicate(MachineBasicBlock *TailBB,
   unsigned MaxDuplicateCount;
   if (MF.getFunction()->hasFnAttr(Attribute::OptimizeForSize))
     MaxDuplicateCount = 1;
-  else if (TII->isProfitableToDuplicateIndirectBranch() &&
-           !TailBB->empty() && TailBB->back().getDesc().isIndirectBranch())
+  else if (!TailBB->empty() && TailBB->back().getDesc().isIndirectBranch())
     // If the target has hardware branch prediction that can handle indirect
     // branches, duplicating them can often make them predictable when there
     // are common paths through the code.  The limit needs to be high enough
index 705f97097c18103982ef810ac869fcd8f024ba57..c95d4c8f3f410d0fdddf36173e54083795fd6e6d 100644 (file)
@@ -1027,12 +1027,6 @@ bool ARMBaseInstrInfo::isIdentical(const MachineInstr *MI0,
   return TargetInstrInfoImpl::isIdentical(MI0, MI1, MRI);
 }
 
-bool ARMBaseInstrInfo::isProfitableToDuplicateIndirectBranch() const {
-  // If the target processor can predict indirect branches, it is highly
-  // desirable to duplicate them, since it can often make them predictable.
-  return getSubtarget().hasBranchTargetBuffer();
-}
-
 /// getInstrPredicate - If instruction is predicated, returns its predicate
 /// condition, otherwise returns AL. It also returns the condition code
 /// register by reference.
index 7944f354b9b9b95da2c751cea8e3c32d596f52ee..282e30c6f9f950a54e900c13d8906732e362922c 100644 (file)
@@ -290,8 +290,6 @@ public:
 
   virtual bool isIdentical(const MachineInstr *MI, const MachineInstr *Other,
                            const MachineRegisterInfo *MRI) const;
-
-  virtual bool isProfitableToDuplicateIndirectBranch() const;
 };
 
 static inline
index d6b072b6c277df6d71f21d9dd132312efaf89210..71f388354d4f9d0467ae75aeb3397a098b44761c 100644 (file)
@@ -114,8 +114,6 @@ ARMSubtarget::ARMSubtarget(const std::string &TT, const std::string &FS,
     if (UseNEONFP.getPosition() == 0)
       UseNEONForSinglePrecisionFP = true;
   }
-  HasBranchTargetBuffer = (CPUString == "cortex-a8" ||
-                           CPUString == "cortex-a9");
 }
 
 /// GVIsIndirectSymbol - true if the GV will be accessed via an indirect symbol.
index b2467b073b5b0f8b987c5308276d2b01cbd8d94b..3f06b7b7f157a6095c6f5700470f7008056e6f30 100644 (file)
@@ -50,9 +50,6 @@ protected:
   /// determine if NEON should actually be used.
   bool UseNEONForSinglePrecisionFP;
 
-  /// HasBranchTargetBuffer - True if processor can predict indirect branches.
-  bool HasBranchTargetBuffer;
-
   /// IsThumb - True if we are in thumb mode, false if in ARM mode.
   bool IsThumb;
 
@@ -130,8 +127,6 @@ protected:
   bool isThumb2() const { return IsThumb && (ThumbMode == Thumb2); }
   bool hasThumb2() const { return ThumbMode >= Thumb2; }
 
-  bool hasBranchTargetBuffer() const { return HasBranchTargetBuffer; }
-
   bool isR9Reserved() const { return IsR9Reserved; }
 
   bool useMovt() const { return UseMovt && hasV6T2Ops(); }
index ab341bd779b40255e86385b0d5c3f952a2375a0c..bb0dc15a7922217e0c90f2e2231f337cda29dbd2 100644 (file)
@@ -151,8 +151,6 @@ public:
   /// instruction may be.  This returns the maximum number of bytes.
   ///
   virtual unsigned GetInstSizeInBytes(const MachineInstr *MI) const;
-
-  virtual bool isProfitableToDuplicateIndirectBranch() const { return true; }
 };
 
 }
index 3d4c2f695d057c24e9fc4c3a2e5d54e0d1ad3b55..c6daa25143064ac99a79a63719208c90fb6091ca 100644 (file)
@@ -632,8 +632,6 @@ public:
   ///
   unsigned getGlobalBaseReg(MachineFunction *MF) const;
 
-  virtual bool isProfitableToDuplicateIndirectBranch() const { return true; }
-
 private:
   MachineInstr* foldMemoryOperandImpl(MachineFunction &MF,
                                      MachineInstr* MI,