diff options
author | Bob Wilson <bob.wilson@apple.com> | 2009-11-30 18:35:03 +0000 |
---|---|---|
committer | Bob Wilson <bob.wilson@apple.com> | 2009-11-30 18:35:03 +0000 |
commit | 15217e63bce6c161b355b63d6496c7c327d15817 (patch) | |
tree | 79b92778bd4803ab19b5437742f094c8a3c669e7 | |
parent | afa1df467b04182c959e6c3031df5377a0062153 (diff) |
Remove isProfitableToDuplicateIndirectBranch target hook. It is profitable
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
-rw-r--r-- | include/llvm/Target/TargetInstrInfo.h | 4 | ||||
-rw-r--r-- | lib/CodeGen/TailDuplication.cpp | 3 | ||||
-rw-r--r-- | lib/Target/ARM/ARMBaseInstrInfo.cpp | 6 | ||||
-rw-r--r-- | lib/Target/ARM/ARMBaseInstrInfo.h | 2 | ||||
-rw-r--r-- | lib/Target/ARM/ARMSubtarget.cpp | 2 | ||||
-rw-r--r-- | lib/Target/ARM/ARMSubtarget.h | 5 | ||||
-rw-r--r-- | lib/Target/PowerPC/PPCInstrInfo.h | 2 | ||||
-rw-r--r-- | lib/Target/X86/X86InstrInfo.h | 2 |
8 files changed, 1 insertions, 25 deletions
diff --git a/include/llvm/Target/TargetInstrInfo.h b/include/llvm/Target/TargetInstrInfo.h index 8070d45858..1ba6b2f299 100644 --- a/include/llvm/Target/TargetInstrInfo.h +++ b/include/llvm/Target/TargetInstrInfo.h @@ -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 diff --git a/lib/CodeGen/TailDuplication.cpp b/lib/CodeGen/TailDuplication.cpp index 12610b0271..68fa2099c8 100644 --- a/lib/CodeGen/TailDuplication.cpp +++ b/lib/CodeGen/TailDuplication.cpp @@ -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 diff --git a/lib/Target/ARM/ARMBaseInstrInfo.cpp b/lib/Target/ARM/ARMBaseInstrInfo.cpp index 705f97097c..c95d4c8f3f 100644 --- a/lib/Target/ARM/ARMBaseInstrInfo.cpp +++ b/lib/Target/ARM/ARMBaseInstrInfo.cpp @@ -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. diff --git a/lib/Target/ARM/ARMBaseInstrInfo.h b/lib/Target/ARM/ARMBaseInstrInfo.h index 7944f354b9..282e30c6f9 100644 --- a/lib/Target/ARM/ARMBaseInstrInfo.h +++ b/lib/Target/ARM/ARMBaseInstrInfo.h @@ -290,8 +290,6 @@ public: virtual bool isIdentical(const MachineInstr *MI, const MachineInstr *Other, const MachineRegisterInfo *MRI) const; - - virtual bool isProfitableToDuplicateIndirectBranch() const; }; static inline diff --git a/lib/Target/ARM/ARMSubtarget.cpp b/lib/Target/ARM/ARMSubtarget.cpp index d6b072b6c2..71f388354d 100644 --- a/lib/Target/ARM/ARMSubtarget.cpp +++ b/lib/Target/ARM/ARMSubtarget.cpp @@ -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. diff --git a/lib/Target/ARM/ARMSubtarget.h b/lib/Target/ARM/ARMSubtarget.h index b2467b073b..3f06b7b7f1 100644 --- a/lib/Target/ARM/ARMSubtarget.h +++ b/lib/Target/ARM/ARMSubtarget.h @@ -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(); } diff --git a/lib/Target/PowerPC/PPCInstrInfo.h b/lib/Target/PowerPC/PPCInstrInfo.h index ab341bd779..bb0dc15a79 100644 --- a/lib/Target/PowerPC/PPCInstrInfo.h +++ b/lib/Target/PowerPC/PPCInstrInfo.h @@ -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; } }; } diff --git a/lib/Target/X86/X86InstrInfo.h b/lib/Target/X86/X86InstrInfo.h index 3d4c2f695d..c6daa25143 100644 --- a/lib/Target/X86/X86InstrInfo.h +++ b/lib/Target/X86/X86InstrInfo.h @@ -632,8 +632,6 @@ public: /// unsigned getGlobalBaseReg(MachineFunction *MF) const; - virtual bool isProfitableToDuplicateIndirectBranch() const { return true; } - private: MachineInstr* foldMemoryOperandImpl(MachineFunction &MF, MachineInstr* MI, |