[llvm-commits] [llvm] r85441 - in /llvm/trunk: lib/CodeGen/BranchFolding.cpp test/CodeGen/X86/2008-02-18-TailMergingBug.ll test/CodeGen/X86/2008-05-12-tailmerge-5.ll test/CodeGen/X86/convert-2-addr-3-addr-inc64.ll
Chris Lattner
clattner at apple.com
Wed Oct 28 17:17:41 PDT 2009
On Oct 28, 2009, at 3:10 PM, Bob Wilson wrote:
> Author: bwilson
> Date: Wed Oct 28 17:10:20 2009
> New Revision: 85441
>
> URL: http://llvm.org/viewvc/llvm-project?rev=85441&view=rev
> Log:
> Reimplement BranchFolding change to avoid tail merging for a 1
> instruction
> common tail, except when the OptimizeForSize function attribute is
> present.
> Radar 7338114.
Hi Bob,
> + // minCommonTailLength instructions in common. Otherwise, if
> we are
> + // optimizing for code size, 1 instruction in common is
> enough. At
> + // worst we will be replacing a fallthrough into the common
> tail with a
> + // branch, which at worst breaks even with falling through
> into the
> + // duplicated common tail. We will always pick a block we do
> not have
> + // to split as the common tail if there is one. (Empty
> blocks will get
> + // forwarded and need not be considered.)
> + MachineFunction *MF = CurMPIter->second->getParent();
> if (CommonTailLen >= minCommonTailLength ||
> (CommonTailLen > 0 &&
> - (TrialBBI1==CurMPIter->second->begin() ||
> - TrialBBI2==I->second->begin()))) {
> + MF->getFunction()->hasFnAttr(Attribute::OptimizeForSize)
> &&
> + (TrialBBI1 == CurMPIter->second->begin() ||
> + TrialBBI2 == I->second->begin()))) {
> if (CommonTailLen > maxCommonTailLength) {
> SameTails.clear();
> maxCommonTailLength = CommonTailLen;
I know that you're probably not the one to blame, but could you factor
out this insane predicate into a static helper function that returns a
bool?
-Chris
More information about the llvm-commits
mailing list