aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2008-09-27 23:22:55 +0000
committerDaniel Dunbar <daniel@zuster.org>2008-09-27 23:22:55 +0000
commit7a3ec1e148c4985775588949d03d9d4d108dec6d (patch)
tree836fda6024a29387b68b70fb098a45ef5bdcda80
parent184793fc8a9cf6ecc9147468bbcc068f472b8517 (diff)
Add IRBuilder::{CreateIsNull, CreateIsNonNull} helper methods.
- I'm open to the idea that these could have better names. I think these read better than CreateEQNull and CreateNENull. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56757 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--include/llvm/Support/IRBuilder.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/include/llvm/Support/IRBuilder.h b/include/llvm/Support/IRBuilder.h
index 0be481bc10..1156825efb 100644
--- a/include/llvm/Support/IRBuilder.h
+++ b/include/llvm/Support/IRBuilder.h
@@ -630,6 +630,23 @@ public:
IdxBegin, IdxEnd - IdxBegin);
return Insert(InsertValueInst::Create(Agg, Val, IdxBegin, IdxEnd), Name);
}
+
+ //===--------------------------------------------------------------------===//
+ // Utility creation methods
+ //===--------------------------------------------------------------------===//
+
+ /// CreateIsNull - Return an i1 value testing if \arg Arg is null.
+ Value *CreateIsNull(Value *Arg, const char *Name = "") {
+ return CreateICmpEQ(Arg, llvm::Constant::getNullValue(Arg->getType()),
+ Name);
+ }
+
+ /// CreateIsNonNull - Return an i1 value testing if \arg Arg is not null.
+ Value *CreateIsNonNull(Value *Arg, const char *Name = "") {
+ return CreateICmpNE(Arg, llvm::Constant::getNullValue(Arg->getType()),
+ Name);
+ }
+
};
}