diff options
author | Bob Wilson <bob.wilson@apple.com> | 2009-12-02 17:15:24 +0000 |
---|---|---|
committer | Bob Wilson <bob.wilson@apple.com> | 2009-12-02 17:15:24 +0000 |
commit | 5eb5f091ab381b612c271a1683e6e0870394d0c4 (patch) | |
tree | 0021aa5ee95f4a4a930c187f4822e835e2eaafe6 /lib/CodeGen | |
parent | 3168d8c736130382a1c7b92a452f3707cc69783a (diff) | |
download | external_llvm-5eb5f091ab381b612c271a1683e6e0870394d0c4.zip external_llvm-5eb5f091ab381b612c271a1683e6e0870394d0c4.tar.gz external_llvm-5eb5f091ab381b612c271a1683e6e0870394d0c4.tar.bz2 |
Don't count PHI instructions toward the limit for tail duplicating a block.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@90326 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen')
-rw-r--r-- | lib/CodeGen/TailDuplication.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/CodeGen/TailDuplication.cpp b/lib/CodeGen/TailDuplication.cpp index 9c0b596..a596458 100644 --- a/lib/CodeGen/TailDuplication.cpp +++ b/lib/CodeGen/TailDuplication.cpp @@ -129,20 +129,22 @@ bool TailDuplicatePass::TailDuplicate(MachineBasicBlock *TailBB, // Check the instructions in the block to determine whether tail-duplication // is invalid or unlikely to be profitable. - unsigned i = 0; + unsigned InstrCount = 0; bool HasCall = false; for (MachineBasicBlock::iterator I = TailBB->begin(); - I != TailBB->end(); ++I, ++i) { + I != TailBB->end(); ++I) { // Non-duplicable things shouldn't be tail-duplicated. if (I->getDesc().isNotDuplicable()) return false; // Don't duplicate more than the threshold. - if (i == MaxDuplicateCount) return false; + if (InstrCount == MaxDuplicateCount) return false; // Remember if we saw a call. if (I->getDesc().isCall()) HasCall = true; + if (I->getOpcode() != TargetInstrInfo::PHI) + InstrCount += 1; } // Heuristically, don't tail-duplicate calls if it would expand code size, // as it's less likely to be worth the extra cost. - if (i > 1 && HasCall) + if (InstrCount > 1 && HasCall) return false; // Iterate through all the unique predecessors and tail-duplicate this |