aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2009-08-11 17:05:24 +0000
committerDan Gohman <gohman@apple.com>2009-08-11 17:05:24 +0000
commit59c4f5c2fc82af14b0f4f332709aac62921c6177 (patch)
tree5292327d7cd9f9a067e7687645fbcf3df77d9b82 /lib
parentd30658c3ffd1e33e98b82750202a9375bf5963ed (diff)
downloadexternal_llvm-59c4f5c2fc82af14b0f4f332709aac62921c6177.zip
external_llvm-59c4f5c2fc82af14b0f4f332709aac62921c6177.tar.gz
external_llvm-59c4f5c2fc82af14b0f4f332709aac62921c6177.tar.bz2
Add convenience functions for creating exact sdiv operators, and
use them in CreatePtrDiff. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78682 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/VMCore/Constants.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/VMCore/Constants.cpp b/lib/VMCore/Constants.cpp
index 43cb390..2670965 100644
--- a/lib/VMCore/Constants.cpp
+++ b/lib/VMCore/Constants.cpp
@@ -605,6 +605,12 @@ Constant* ConstantVector::get(Constant* const* Vals, unsigned NumVals) {
return get(std::vector<Constant*>(Vals, Vals+NumVals));
}
+Constant* ConstantExpr::getExactSDiv(Constant* C1, Constant* C2) {
+ Constant *C = getSDiv(C1, C2);
+ cast<SDivOperator>(C)->setIsExact(true);
+ return C;
+}
+
// Utility function for determining if a ConstantExpr is a CastOp or not. This
// can't be inline because we don't want to #include Instruction.h into
// Constant.h