[llvm-commits] [llvm] r86930 - /llvm/trunk/include/llvm/InstrTypes.h
Nick Lewycky
nicholas at mxc.ca
Wed Nov 11 18:08:11 PST 2009
Author: nicholas
Date: Wed Nov 11 20:08:11 2009
New Revision: 86930
URL: http://llvm.org/viewvc/llvm-project?rev=86930&view=rev
Log:
Add CreateNUWAdd and CreateNUWSub to complement the existing CreateNSWAdd and
CreateNSWSub functions.
Modified:
llvm/trunk/include/llvm/InstrTypes.h
Modified: llvm/trunk/include/llvm/InstrTypes.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/InstrTypes.h?rev=86930&r1=86929&r2=86930&view=diff
==============================================================================
--- llvm/trunk/include/llvm/InstrTypes.h (original)
+++ llvm/trunk/include/llvm/InstrTypes.h Wed Nov 11 20:08:11 2009
@@ -214,6 +214,27 @@
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 @@
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,
More information about the llvm-commits
mailing list