diff options
| author | Bob Wilson <bob.wilson@apple.com> | 2009-11-24 23:35:49 +0000 |
|---|---|---|
| committer | Bob Wilson <bob.wilson@apple.com> | 2009-11-24 23:35:49 +0000 |
| commit | d4d40670e8b9ff752362d157806e41028d523007 (patch) | |
| tree | 30953aa111aab45d9d4526e3f0f5cb7791260146 /llvm/lib/Target/ARM | |
| parent | 5ece8f0a204987bf4fcc3ef4eff072153e462ca6 (diff) | |
| download | bcm5719-llvm-d4d40670e8b9ff752362d157806e41028d523007.tar.gz bcm5719-llvm-d4d40670e8b9ff752362d157806e41028d523007.zip | |
Refactor target hook for tail duplication as requested by Chris.
Make tail duplication of indirect branches much more aggressive (for targets
that indicate that it is profitable), based on further experience with
this transformation. I compiled 3 large applications with and without
this more aggressive tail duplication and measured minimal changes in code
size. ("size" on Darwin seems to round the text size up to the nearest
page boundary, so I can only say that any code size increase was less than
one 4k page.) Radar 7421267.
llvm-svn: 89814
Diffstat (limited to 'llvm/lib/Target/ARM')
| -rw-r--r-- | llvm/lib/Target/ARM/ARMBaseInstrInfo.cpp | 8 | ||||
| -rw-r--r-- | llvm/lib/Target/ARM/ARMBaseInstrInfo.h | 3 |
2 files changed, 3 insertions, 8 deletions
diff --git a/llvm/lib/Target/ARM/ARMBaseInstrInfo.cpp b/llvm/lib/Target/ARM/ARMBaseInstrInfo.cpp index c92ec368a79..705f97097c1 100644 --- a/llvm/lib/Target/ARM/ARMBaseInstrInfo.cpp +++ b/llvm/lib/Target/ARM/ARMBaseInstrInfo.cpp @@ -1027,14 +1027,10 @@ bool ARMBaseInstrInfo::isIdentical(const MachineInstr *MI0, return TargetInstrInfoImpl::isIdentical(MI0, MI1, MRI); } -unsigned ARMBaseInstrInfo::TailDuplicationLimit(const MachineBasicBlock &MBB, - unsigned DefaultLimit) const { +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. - if (!MBB.empty() && isIndirectBranchOpcode(MBB.back().getOpcode()) && - getSubtarget().hasBranchTargetBuffer()) - return DefaultLimit + 2; - return DefaultLimit; + return getSubtarget().hasBranchTargetBuffer(); } /// getInstrPredicate - If instruction is predicated, returns its predicate diff --git a/llvm/lib/Target/ARM/ARMBaseInstrInfo.h b/llvm/lib/Target/ARM/ARMBaseInstrInfo.h index dbd4f63619d..7944f354b9b 100644 --- a/llvm/lib/Target/ARM/ARMBaseInstrInfo.h +++ b/llvm/lib/Target/ARM/ARMBaseInstrInfo.h @@ -291,8 +291,7 @@ public: virtual bool isIdentical(const MachineInstr *MI, const MachineInstr *Other, const MachineRegisterInfo *MRI) const; - virtual unsigned TailDuplicationLimit(const MachineBasicBlock &MBB, - unsigned DefaultLimit) const; + virtual bool isProfitableToDuplicateIndirectBranch() const; }; static inline |

