diff options
| author | Chris Lattner <sabre@nondot.org> | 2011-01-08 07:21:31 +0000 |
|---|---|---|
| committer | Chris Lattner <sabre@nondot.org> | 2011-01-08 07:21:31 +0000 |
| commit | 2b3f20e6ec3b9822e163105c9dd2b7ff9476dc60 (patch) | |
| tree | 8e1aa3ac0da48a8f9e65d866937f75ca5e61bdaa /llvm/lib/Transforms | |
| parent | b35635e9423491a29a00feea80db645ada95ab7b (diff) | |
| download | bcm5719-llvm-2b3f20e6ec3b9822e163105c9dd2b7ff9476dc60.tar.gz bcm5719-llvm-2b3f20e6ec3b9822e163105c9dd2b7ff9476dc60.zip | |
two minor changes: switch to the standard ValueToValueMapTy
map from ValueMapper.h (giving us access to its utilities)
and add a fastpath in the loop rotation code, avoiding expensive
ssa updator manipulation for values with nothing to update.
llvm-svn: 123057
Diffstat (limited to 'llvm/lib/Transforms')
| -rw-r--r-- | llvm/lib/Transforms/Scalar/LoopRotation.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/llvm/lib/Transforms/Scalar/LoopRotation.cpp b/llvm/lib/Transforms/Scalar/LoopRotation.cpp index 1e655fdc4cc..ba1a27983bc 100644 --- a/llvm/lib/Transforms/Scalar/LoopRotation.cpp +++ b/llvm/lib/Transforms/Scalar/LoopRotation.cpp @@ -21,10 +21,10 @@ #include "llvm/Transforms/Utils/Local.h" #include "llvm/Transforms/Utils/BasicBlockUtils.h" #include "llvm/Transforms/Utils/SSAUpdater.h" +#include "llvm/Transforms/Utils/ValueMapper.h" #include "llvm/Support/CommandLine.h" #include "llvm/Support/Debug.h" #include "llvm/ADT/Statistic.h" -#include "llvm/ADT/SmallVector.h" using namespace llvm; #define MAX_HEADER_SIZE 16 @@ -177,7 +177,7 @@ bool LoopRotate::rotateLoop(Loop *Lp, LPPassManager &LPM) { // Begin by walking OrigHeader and populating ValueMap with an entry for // each Instruction. BasicBlock::iterator I = OrigHeader->begin(), E = OrigHeader->end(); - DenseMap<const Value *, Value *> ValueMap; + ValueToValueMapTy ValueMap; // For PHI nodes, the value available in OldPreHeader is just the // incoming value from OldPreHeader. @@ -233,6 +233,11 @@ bool LoopRotate::rotateLoop(Loop *Lp, LPPassManager &LPM) { Value *OrigHeaderVal = I; Value *OrigPreHeaderVal = ValueMap[OrigHeaderVal]; + // If there are no uses of the value (e.g. because it returns void), there + // is nothing to rewrite. + if (OrigHeaderVal->use_empty() && OrigPreHeaderVal->use_empty()) + continue; + // The value now exits in two versions: the initial value in the preheader // and the loop "next" value in the original header. SSA.Initialize(OrigHeaderVal->getType(), OrigHeaderVal->getName()); |

