Add CreateNUWAdd and CreateNUWSub to complement the existing CreateNSWAdd and

CreateNSWSub functions.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86930 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Nick Lewycky 2009-11-12 02:08:11 +00:00
parent 3e04a05672
commit ad108baf47

View File

@ -214,6 +214,27 @@ public:
return BO;
}
/// CreateNUWAdd - Create an Add operator with the NUW flag set.
///
static BinaryOperator *CreateNUWAdd(Value *V1, Value *V2,
const Twine &Name = "") {
BinaryOperator *BO = CreateAdd(V1, V2, Name);
BO->setHasNoUnsignedWrap(true);
return BO;
}
static BinaryOperator *CreateNUWAdd(Value *V1, Value *V2,
const Twine &Name, BasicBlock *BB) {
BinaryOperator *BO = CreateAdd(V1, V2, Name, BB);
BO->setHasNoUnsignedWrap(true);
return BO;
}
static BinaryOperator *CreateNUWAdd(Value *V1, Value *V2,
const Twine &Name, Instruction *I) {
BinaryOperator *BO = CreateAdd(V1, V2, Name, I);
BO->setHasNoUnsignedWrap(true);
return BO;
}
/// CreateNSWSub - Create an Sub operator with the NSW flag set.
///
static BinaryOperator *CreateNSWSub(Value *V1, Value *V2,
@ -235,6 +256,27 @@ public:
return BO;
}
/// CreateNUWSub - Create an Sub operator with the NUW flag set.
///
static BinaryOperator *CreateNUWSub(Value *V1, Value *V2,
const Twine &Name = "") {
BinaryOperator *BO = CreateSub(V1, V2, Name);
BO->setHasNoUnsignedWrap(true);
return BO;
}
static BinaryOperator *CreateNUWSub(Value *V1, Value *V2,
const Twine &Name, BasicBlock *BB) {
BinaryOperator *BO = CreateSub(V1, V2, Name, BB);
BO->setHasNoUnsignedWrap(true);
return BO;
}
static BinaryOperator *CreateNUWSub(Value *V1, Value *V2,
const Twine &Name, Instruction *I) {
BinaryOperator *BO = CreateSub(V1, V2, Name, I);
BO->setHasNoUnsignedWrap(true);
return BO;
}
/// CreateExactSDiv - Create an SDiv operator with the exact flag set.
///
static BinaryOperator *CreateExactSDiv(Value *V1, Value *V2,