diff options
author | Dan Gohman <gohman@apple.com> | 2010-01-19 21:55:32 +0000 |
---|---|---|
committer | Dan Gohman <gohman@apple.com> | 2010-01-19 21:55:32 +0000 |
commit | d6934728210baf1ff2739e97ea78a8ee23e5e6d0 (patch) | |
tree | aec63cc2473f2d72f53a3dcb5cb3ae1921354516 /llvm/lib/Analysis/IVUsers.cpp | |
parent | fb9bea7150aff81135c54713ec9b60d68cf4bed2 (diff) | |
download | bcm5719-llvm-d6934728210baf1ff2739e97ea78a8ee23e5e6d0.tar.gz bcm5719-llvm-d6934728210baf1ff2739e97ea78a8ee23e5e6d0.zip |
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.
llvm-svn: 93921
Diffstat (limited to 'llvm/lib/Analysis/IVUsers.cpp')
-rw-r--r-- | llvm/lib/Analysis/IVUsers.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/llvm/lib/Analysis/IVUsers.cpp b/llvm/lib/Analysis/IVUsers.cpp index 26c0c9e4ba8..92f00273a2c 100644 --- a/llvm/lib/Analysis/IVUsers.cpp +++ b/llvm/lib/Analysis/IVUsers.cpp @@ -333,6 +333,19 @@ const SCEV *IVUsers::getReplacementExpr(const IVStrideUse &U) const { 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); |