diff options
author | Devang Patel <dpatel@apple.com> | 2009-03-06 03:51:30 +0000 |
---|---|---|
committer | Devang Patel <dpatel@apple.com> | 2009-03-06 03:51:30 +0000 |
commit | 3f43a7021fae71c056f5e1afc60016cfd8193f68 (patch) | |
tree | 6c007ef05fc50e7049eda515c8629a9715b907bc | |
parent | c64bc16cae098d87aafca438adb21bc580be1db1 (diff) |
Do not count DbgInfoIntrinsic while estimating loop header size.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66245 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/Transforms/Scalar/LoopRotation.cpp | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/lib/Transforms/Scalar/LoopRotation.cpp b/lib/Transforms/Scalar/LoopRotation.cpp index 65b74b4e7f..a088230133 100644 --- a/lib/Transforms/Scalar/LoopRotation.cpp +++ b/lib/Transforms/Scalar/LoopRotation.cpp @@ -14,7 +14,7 @@ #define DEBUG_TYPE "loop-rotate" #include "llvm/Transforms/Scalar.h" #include "llvm/Function.h" -#include "llvm/Instructions.h" +#include "llvm/IntrinsicInst.h" #include "llvm/Analysis/LoopInfo.h" #include "llvm/Analysis/LoopPass.h" #include "llvm/Analysis/Dominators.h" @@ -161,7 +161,19 @@ bool LoopRotate::rotateLoop(Loop *Lp, LPPassManager &LPM) { // Check size of original header and reject // loop if it is very big. - if (OrigHeader->size() > MAX_HEADER_SIZE) + unsigned Size = 0; + + // FIXME: Use common api to estimate size. + for (BasicBlock::const_iterator OI = OrigHeader->begin(), + OE = OrigHeader->end(); OI != OE; ++OI) { + if (isa<PHINode>(OI)) + continue; // PHI nodes don't count. + if (isa<DbgInfoIntrinsic>(OI)) + continue; // Debug intrinsics don't count as size. + Size++; + } + + if (Size > MAX_HEADER_SIZE) return false; // Now, this loop is suitable for rotation. |