aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Transforms
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2010-07-26 18:02:06 +0000
committerDan Gohman <gohman@apple.com>2010-07-26 18:02:06 +0000
commit572365ec88aeb78908acb7efe381e45ab0b4a50a (patch)
treed101f4a4eb69e630b98a086b384ccb3e7aa50831 /lib/Transforms
parent3d0c7231fd5fc6af4407c9b2e3267b1acba2570f (diff)
downloadexternal_llvm-572365ec88aeb78908acb7efe381e45ab0b4a50a.zip
external_llvm-572365ec88aeb78908acb7efe381e45ab0b4a50a.tar.gz
external_llvm-572365ec88aeb78908acb7efe381e45ab0b4a50a.tar.bz2
Preserve ScalarEvolution in the loop unroller.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@109412 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms')
-rw-r--r--lib/Transforms/Utils/LoopUnroll.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/Transforms/Utils/LoopUnroll.cpp b/lib/Transforms/Utils/LoopUnroll.cpp
index e0e07e7..236bbe9 100644
--- a/lib/Transforms/Utils/LoopUnroll.cpp
+++ b/lib/Transforms/Utils/LoopUnroll.cpp
@@ -24,6 +24,7 @@
#include "llvm/ADT/Statistic.h"
#include "llvm/Analysis/ConstantFolding.h"
#include "llvm/Analysis/LoopPass.h"
+#include "llvm/Analysis/ScalarEvolution.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/Transforms/Utils/BasicBlockUtils.h"
@@ -127,6 +128,11 @@ bool llvm::UnrollLoop(Loop *L, unsigned Count, LoopInfo* LI, LPPassManager* LPM)
return false;
}
+ // Notify ScalarEvolution that the loop will be substantially changed,
+ // if not outright eliminated.
+ if (ScalarEvolution *SE = LPM->getAnalysisIfAvailable<ScalarEvolution>())
+ SE->forgetLoop(L);
+
// Find trip count
unsigned TripCount = L->getSmallConstantTripCount();
// Find trip multiple if count is not available