[llvm-commits] [llvm] r109412 - /llvm/trunk/lib/Transforms/Utils/LoopUnroll.cpp
Dan Gohman
gohman at apple.com
Mon Jul 26 11:02:06 PDT 2010
Author: djg
Date: Mon Jul 26 13:02:06 2010
New Revision: 109412
URL: http://llvm.org/viewvc/llvm-project?rev=109412&view=rev
Log:
Preserve ScalarEvolution in the loop unroller.
Modified:
llvm/trunk/lib/Transforms/Utils/LoopUnroll.cpp
Modified: llvm/trunk/lib/Transforms/Utils/LoopUnroll.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/LoopUnroll.cpp?rev=109412&r1=109411&r2=109412&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Utils/LoopUnroll.cpp (original)
+++ llvm/trunk/lib/Transforms/Utils/LoopUnroll.cpp Mon Jul 26 13:02:06 2010
@@ -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 @@
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
More information about the llvm-commits
mailing list