diff options
| author | Dan Gohman <gohman@apple.com> | 2009-08-11 17:05:24 +0000 |
|---|---|---|
| committer | Dan Gohman <gohman@apple.com> | 2009-08-11 17:05:24 +0000 |
| commit | 58f4d89a10ee340577a3a84a5d10cd17cf820c13 (patch) | |
| tree | 7d6b0aa3c036234338034a7f568903ac3bebd606 /llvm/lib/VMCore/Constants.cpp | |
| parent | d6c611e6e8fb869d99feb0c1f530b13f974d54d0 (diff) | |
| download | bcm5719-llvm-58f4d89a10ee340577a3a84a5d10cd17cf820c13.tar.gz bcm5719-llvm-58f4d89a10ee340577a3a84a5d10cd17cf820c13.zip | |
Add convenience functions for creating exact sdiv operators, and
use them in CreatePtrDiff.
llvm-svn: 78682
Diffstat (limited to 'llvm/lib/VMCore/Constants.cpp')
| -rw-r--r-- | llvm/lib/VMCore/Constants.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/llvm/lib/VMCore/Constants.cpp b/llvm/lib/VMCore/Constants.cpp index 43cb39016f9..2670965f734 100644 --- a/llvm/lib/VMCore/Constants.cpp +++ b/llvm/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 |

