diff options
author | Nick Lewycky <nicholas@mxc.ca> | 2008-02-20 06:48:22 +0000 |
---|---|---|
committer | Nick Lewycky <nicholas@mxc.ca> | 2008-02-20 06:48:22 +0000 |
commit | e7a24ff7074cb3073c00feccd65ed0aef1e07b68 (patch) | |
tree | ebc561431001a1c949d932f9f8224b4ed7391ee9 /include/llvm/Analysis/ScalarEvolutionExpressions.h | |
parent | f5e3e189858abfe3c24ef72b62bb6d94940a3e30 (diff) | |
download | external_llvm-e7a24ff7074cb3073c00feccd65ed0aef1e07b68.zip external_llvm-e7a24ff7074cb3073c00feccd65ed0aef1e07b68.tar.gz external_llvm-e7a24ff7074cb3073c00feccd65ed0aef1e07b68.tar.bz2 |
Add 'umax' similar to 'smax' SCEV. Closes PR2003.
Parse reversed smax and umax as smin and umin and express them with negative
or binary-not SCEVs (which are really just subtract under the hood).
Parse 'xor %x, -1' as (-1 - %x).
Remove dead code (ConstantInt::get always returns a ConstantInt).
Don't use getIntegerSCEV(-1, Ty). The first value is an int, then it gets
passed into a uint64_t. Instead, create the -1 directly from
ConstantInt::getAllOnesValue().
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47360 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/Analysis/ScalarEvolutionExpressions.h')
-rw-r--r-- | include/llvm/Analysis/ScalarEvolutionExpressions.h | 30 |
1 files changed, 27 insertions, 3 deletions
diff --git a/include/llvm/Analysis/ScalarEvolutionExpressions.h b/include/llvm/Analysis/ScalarEvolutionExpressions.h index 409ad9e..905493a 100644 --- a/include/llvm/Analysis/ScalarEvolutionExpressions.h +++ b/include/llvm/Analysis/ScalarEvolutionExpressions.h @@ -25,7 +25,8 @@ namespace llvm { // These should be ordered in terms of increasing complexity to make the // folders simpler. scConstant, scTruncate, scZeroExtend, scSignExtend, scAddExpr, scMulExpr, - scUDivExpr, scAddRecExpr, scSMaxExpr, scUnknown, scCouldNotCompute + scUDivExpr, scAddRecExpr, scUMaxExpr, scSMaxExpr, scUnknown, + scCouldNotCompute }; //===--------------------------------------------------------------------===// @@ -275,7 +276,8 @@ namespace llvm { static inline bool classof(const SCEV *S) { return S->getSCEVType() == scAddExpr || S->getSCEVType() == scMulExpr || - S->getSCEVType() == scSMaxExpr; + S->getSCEVType() == scSMaxExpr || + S->getSCEVType() == scUMaxExpr; } }; @@ -483,6 +485,27 @@ namespace llvm { //===--------------------------------------------------------------------===// + /// SCEVUMaxExpr - This class represents an unsigned maximum selection. + /// + class SCEVUMaxExpr : public SCEVCommutativeExpr { + friend class ScalarEvolution; + + explicit SCEVUMaxExpr(const std::vector<SCEVHandle> &ops) + : SCEVCommutativeExpr(scUMaxExpr, ops) { + } + + public: + virtual const char *getOperationStr() const { return " umax "; } + + /// Methods for support type inquiry through isa, cast, and dyn_cast: + static inline bool classof(const SCEVUMaxExpr *S) { return true; } + static inline bool classof(const SCEV *S) { + return S->getSCEVType() == scUMaxExpr; + } + }; + + + //===--------------------------------------------------------------------===// /// SCEVUnknown - This means that we are dealing with an entirely unknown SCEV /// value, and only represent it as it's LLVM Value. This is the "bottom" /// value for the analysis. @@ -546,6 +569,8 @@ namespace llvm { return ((SC*)this)->visitAddRecExpr((SCEVAddRecExpr*)S); case scSMaxExpr: return ((SC*)this)->visitSMaxExpr((SCEVSMaxExpr*)S); + case scUMaxExpr: + return ((SC*)this)->visitUMaxExpr((SCEVUMaxExpr*)S); case scUnknown: return ((SC*)this)->visitUnknown((SCEVUnknown*)S); case scCouldNotCompute: @@ -565,4 +590,3 @@ namespace llvm { } #endif - |