aboutsummaryrefslogtreecommitdiffstats
path: root/include/llvm
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2009-09-03 22:17:40 +0000
committerDan Gohman <gohman@apple.com>2009-09-03 22:17:40 +0000
commite56a94ef91009ddb8d8b68783ff1650bcad3b326 (patch)
tree1c8c18901981239213e9c0c60e52786bd8916c38 /include/llvm
parent5e41178a6ee9a0faa2c031811d32543d7e9d0aff (diff)
downloadexternal_llvm-e56a94ef91009ddb8d8b68783ff1650bcad3b326.zip
external_llvm-e56a94ef91009ddb8d8b68783ff1650bcad3b326.tar.gz
external_llvm-e56a94ef91009ddb8d8b68783ff1650bcad3b326.tar.bz2
Remove the API for creating ConstantExprs with the nsw, nuw, inbounds,
and exact flags. Because ConstantExprs are uniqued, creating an expression with this flag causes all expressions with the same operands to have the same flag, which may not be safe. Add, sub, mul, and sdiv ConstantExprs are usually folded anyway, so the main interesting flag here is inbounds, and the constant folder already knows how to set the inbounds flag automatically in most cases, so there isn't an urgent need for the API support. This can be reconsidered in the future, but for now just removing these API bits eliminates a source of potential trouble with little downside. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80959 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm')
-rw-r--r--include/llvm/Constants.h12
-rw-r--r--include/llvm/Support/ConstantFolder.h8
-rw-r--r--include/llvm/Support/NoFolder.h2
-rw-r--r--include/llvm/Support/TargetFolder.h8
4 files changed, 9 insertions, 21 deletions
diff --git a/include/llvm/Constants.h b/include/llvm/Constants.h
index da6fe96..8566ba0 100644
--- a/include/llvm/Constants.h
+++ b/include/llvm/Constants.h
@@ -648,9 +648,6 @@ public:
static Constant *getIntToPtr(Constant *C, const Type *Ty);
static Constant *getBitCast (Constant *C, const Type *Ty);
- static Constant* getNSWAdd(Constant* C1, Constant* C2);
- static Constant* getExactSDiv(Constant* C1, Constant* C2);
-
/// Transparently provide more efficient getOperand methods.
DECLARE_TRANSPARENT_OPERAND_ACCESSORS(Constant);
@@ -737,15 +734,6 @@ public:
static Constant *getGetElementPtr(Constant *C,
Value* const *IdxList, unsigned NumIdx);
- /// Create an "inbounds" getelementptr. See the documentation for the
- /// "inbounds" flag in LangRef.html for details.
- static Constant *getInBoundsGetElementPtr(Constant *C,
- Constant* const *IdxList,
- unsigned NumIdx);
- static Constant *getInBoundsGetElementPtr(Constant *C,
- Value* const *IdxList,
- unsigned NumIdx);
-
static Constant *getExtractElement(Constant *Vec, Constant *Idx);
static Constant *getInsertElement(Constant *Vec, Constant *Elt,Constant *Idx);
static Constant *getShuffleVector(Constant *V1, Constant *V2, Constant *Mask);
diff --git a/include/llvm/Support/ConstantFolder.h b/include/llvm/Support/ConstantFolder.h
index 3c9278a..8ce5237 100644
--- a/include/llvm/Support/ConstantFolder.h
+++ b/include/llvm/Support/ConstantFolder.h
@@ -36,7 +36,7 @@ public:
return ConstantExpr::getAdd(LHS, RHS);
}
Constant *CreateNSWAdd(Constant *LHS, Constant *RHS) const {
- return ConstantExpr::getNSWAdd(LHS, RHS);
+ return ConstantExpr::getAdd(LHS, RHS);
}
Constant *CreateFAdd(Constant *LHS, Constant *RHS) const {
return ConstantExpr::getFAdd(LHS, RHS);
@@ -60,7 +60,7 @@ public:
return ConstantExpr::getSDiv(LHS, RHS);
}
Constant *CreateExactSDiv(Constant *LHS, Constant *RHS) const {
- return ConstantExpr::getExactSDiv(LHS, RHS);
+ return ConstantExpr::getSDiv(LHS, RHS);
}
Constant *CreateFDiv(Constant *LHS, Constant *RHS) const {
return ConstantExpr::getFDiv(LHS, RHS);
@@ -127,11 +127,11 @@ public:
Constant *CreateInBoundsGetElementPtr(Constant *C, Constant* const *IdxList,
unsigned NumIdx) const {
- return ConstantExpr::getInBoundsGetElementPtr(C, IdxList, NumIdx);
+ return ConstantExpr::getGetElementPtr(C, IdxList, NumIdx);
}
Constant *CreateInBoundsGetElementPtr(Constant *C, Value* const *IdxList,
unsigned NumIdx) const {
- return ConstantExpr::getInBoundsGetElementPtr(C, IdxList, NumIdx);
+ return ConstantExpr::getGetElementPtr(C, IdxList, NumIdx);
}
//===--------------------------------------------------------------------===//
diff --git a/include/llvm/Support/NoFolder.h b/include/llvm/Support/NoFolder.h
index 4540f02..0072471 100644
--- a/include/llvm/Support/NoFolder.h
+++ b/include/llvm/Support/NoFolder.h
@@ -131,7 +131,7 @@ public:
Constant *CreateInBoundsGetElementPtr(Constant *C, Constant* const *IdxList,
unsigned NumIdx) const {
- return ConstantExpr::getInBoundsGetElementPtr(C, IdxList, NumIdx);
+ return ConstantExpr::getGetElementPtr(C, IdxList, NumIdx);
}
Value *CreateInBoundsGetElementPtr(Constant *C, Value* const *IdxList,
unsigned NumIdx) const {
diff --git a/include/llvm/Support/TargetFolder.h b/include/llvm/Support/TargetFolder.h
index 77533c0..80ab900 100644
--- a/include/llvm/Support/TargetFolder.h
+++ b/include/llvm/Support/TargetFolder.h
@@ -52,7 +52,7 @@ public:
return Fold(ConstantExpr::getAdd(LHS, RHS));
}
Constant *CreateNSWAdd(Constant *LHS, Constant *RHS) const {
- return Fold(ConstantExpr::getNSWAdd(LHS, RHS));
+ return Fold(ConstantExpr::getAdd(LHS, RHS));
}
Constant *CreateFAdd(Constant *LHS, Constant *RHS) const {
return Fold(ConstantExpr::getFAdd(LHS, RHS));
@@ -76,7 +76,7 @@ public:
return Fold(ConstantExpr::getSDiv(LHS, RHS));
}
Constant *CreateExactSDiv(Constant *LHS, Constant *RHS) const {
- return Fold(ConstantExpr::getExactSDiv(LHS, RHS));
+ return Fold(ConstantExpr::getSDiv(LHS, RHS));
}
Constant *CreateFDiv(Constant *LHS, Constant *RHS) const {
return Fold(ConstantExpr::getFDiv(LHS, RHS));
@@ -143,11 +143,11 @@ public:
Constant *CreateInBoundsGetElementPtr(Constant *C, Constant* const *IdxList,
unsigned NumIdx) const {
- return Fold(ConstantExpr::getInBoundsGetElementPtr(C, IdxList, NumIdx));
+ return Fold(ConstantExpr::getGetElementPtr(C, IdxList, NumIdx));
}
Constant *CreateInBoundsGetElementPtr(Constant *C, Value* const *IdxList,
unsigned NumIdx) const {
- return Fold(ConstantExpr::getInBoundsGetElementPtr(C, IdxList, NumIdx));
+ return Fold(ConstantExpr::getGetElementPtr(C, IdxList, NumIdx));
}
//===--------------------------------------------------------------------===//