summaryrefslogtreecommitdiff
path: root/include/llvm/Analysis/ScalarEvolutionExpressions.h
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2009-10-09 00:10:36 +0000
committerDan Gohman <gohman@apple.com>2009-10-09 00:10:36 +0000
commit3645b01002e7ac244c1f3d163e5e350df21d869d (patch)
tree6609299ae5e2d8b6db0a101acb030aac8471b3ce /include/llvm/Analysis/ScalarEvolutionExpressions.h
parent5631139a699578e3281a1ae09f2cdf4d332179c8 (diff)
downloadllvm-3645b01002e7ac244c1f3d163e5e350df21d869d.tar.gz
llvm-3645b01002e7ac244c1f3d163e5e350df21d869d.tar.bz2
llvm-3645b01002e7ac244c1f3d163e5e350df21d869d.tar.xz
Add the ability to track HasNSW and HasNUW on more kinds of SCEV expressions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83601 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/Analysis/ScalarEvolutionExpressions.h')
-rw-r--r--include/llvm/Analysis/ScalarEvolutionExpressions.h24
1 files changed, 15 insertions, 9 deletions
diff --git a/include/llvm/Analysis/ScalarEvolutionExpressions.h b/include/llvm/Analysis/ScalarEvolutionExpressions.h
index 67f5e06977..2c50350603 100644
--- a/include/llvm/Analysis/ScalarEvolutionExpressions.h
+++ b/include/llvm/Analysis/ScalarEvolutionExpressions.h
@@ -234,6 +234,15 @@ namespace llvm {
virtual const Type *getType() const { return getOperand(0)->getType(); }
+ bool hasNoUnsignedWrap() const { return SubclassData & (1 << 0); }
+ void setHasNoUnsignedWrap(bool B) {
+ SubclassData = (SubclassData & ~(1 << 0)) | (B << 0);
+ }
+ bool hasNoSignedWrap() const { return SubclassData & (1 << 1); }
+ void setHasNoSignedWrap(bool B) {
+ SubclassData = (SubclassData & ~(1 << 1)) | (B << 1);
+ }
+
/// Methods for support type inquiry through isa, cast, and dyn_cast:
static inline bool classof(const SCEVNAryExpr *S) { return true; }
static inline bool classof(const SCEV *S) {
@@ -436,15 +445,6 @@ namespace llvm {
return cast<SCEVAddRecExpr>(SE.getAddExpr(this, getStepRecurrence(SE)));
}
- bool hasNoUnsignedWrap() const { return SubclassData & (1 << 0); }
- void setHasNoUnsignedWrap(bool B) {
- SubclassData = (SubclassData & ~(1 << 0)) | (B << 0);
- }
- bool hasNoSignedWrap() const { return SubclassData & (1 << 1); }
- void setHasNoSignedWrap(bool B) {
- SubclassData = (SubclassData & ~(1 << 1)) | (B << 1);
- }
-
virtual void print(raw_ostream &OS) const;
/// Methods for support type inquiry through isa, cast, and dyn_cast:
@@ -464,6 +464,9 @@ namespace llvm {
SCEVSMaxExpr(const FoldingSetNodeID &ID,
const SmallVectorImpl<const SCEV *> &ops)
: SCEVCommutativeExpr(ID, scSMaxExpr, ops) {
+ // Max never overflows.
+ setHasNoUnsignedWrap(true);
+ setHasNoSignedWrap(true);
}
public:
@@ -486,6 +489,9 @@ namespace llvm {
SCEVUMaxExpr(const FoldingSetNodeID &ID,
const SmallVectorImpl<const SCEV *> &ops)
: SCEVCommutativeExpr(ID, scUMaxExpr, ops) {
+ // Max never overflows.
+ setHasNoUnsignedWrap(true);
+ setHasNoSignedWrap(true);
}
public: