[llvm-commits] [llvm] r93921 - in /llvm/trunk: include/llvm/Analysis/IVUsers.h lib/Analysis/IVUsers.cpp
Dan Gohman
gohman at apple.com
Tue Jan 19 13:55:33 PST 2010
Author: djg
Date: Tue Jan 19 15:55:32 2010
New Revision: 93921
URL: http://llvm.org/viewvc/llvm-project?rev=93921&view=rev
Log:
Add a new helper function to IVUsers for returning the "canonical"
form of an expression. This is the expression without the
post-increment adjustment made, which is useful in determining
which registers will be used by the expansion.
Modified:
llvm/trunk/include/llvm/Analysis/IVUsers.h
llvm/trunk/lib/Analysis/IVUsers.cpp
Modified: llvm/trunk/include/llvm/Analysis/IVUsers.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/IVUsers.h?rev=93921&r1=93920&r2=93921&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Analysis/IVUsers.h (original)
+++ llvm/trunk/include/llvm/Analysis/IVUsers.h Tue Jan 19 15:55:32 2010
@@ -212,6 +212,11 @@
/// value of the OperandValToReplace of the given IVStrideUse.
const SCEV *getReplacementExpr(const IVStrideUse &U) const;
+ /// getCanonicalExpr - Return a SCEV expression which computes the
+ /// value of the SCEV of the given IVStrideUse, ignoring the
+ /// isUseOfPostIncrementedValue flag.
+ const SCEV *getCanonicalExpr(const IVStrideUse &U) const;
+
void print(raw_ostream &OS, const Module* = 0) const;
/// dump - This method is used for debugging.
Modified: llvm/trunk/lib/Analysis/IVUsers.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/IVUsers.cpp?rev=93921&r1=93920&r2=93921&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/IVUsers.cpp (original)
+++ llvm/trunk/lib/Analysis/IVUsers.cpp Tue Jan 19 15:55:32 2010
@@ -333,6 +333,19 @@
return RetVal;
}
+/// getCanonicalExpr - Return a SCEV expression which computes the
+/// value of the SCEV of the given IVStrideUse, ignoring the
+/// isUseOfPostIncrementedValue flag.
+const SCEV *IVUsers::getCanonicalExpr(const IVStrideUse &U) const {
+ // Start with zero.
+ const SCEV *RetVal = SE->getIntegerSCEV(0, U.getParent()->Stride->getType());
+ // Create the basic add recurrence.
+ RetVal = SE->getAddRecExpr(RetVal, U.getParent()->Stride, L);
+ // Add the offset in a separate step, because it may be loop-variant.
+ RetVal = SE->getAddExpr(RetVal, U.getOffset());
+ return RetVal;
+}
+
void IVUsers::print(raw_ostream &OS, const Module *M) const {
OS << "IV Users for loop ";
WriteAsOperand(OS, L->getHeader(), false);
More information about the llvm-commits
mailing list