[llvm-commits] [llvm] r90326 - /llvm/trunk/lib/CodeGen/TailDuplication.cpp
Bob Wilson
bob.wilson at apple.com
Wed Dec 2 09:15:24 PST 2009
Author: bwilson
Date: Wed Dec 2 11:15:24 2009
New Revision: 90326
URL: http://llvm.org/viewvc/llvm-project?rev=90326&view=rev
Log:
Don't count PHI instructions toward the limit for tail duplicating a block.
Modified:
llvm/trunk/lib/CodeGen/TailDuplication.cpp
Modified: llvm/trunk/lib/CodeGen/TailDuplication.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/TailDuplication.cpp?rev=90326&r1=90325&r2=90326&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/TailDuplication.cpp (original)
+++ llvm/trunk/lib/CodeGen/TailDuplication.cpp Wed Dec 2 11:15:24 2009
@@ -129,20 +129,22 @@
// 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
More information about the llvm-commits
mailing list