aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/IR/LLVMContext.cpp
diff options
context:
space:
mode:
authorSanjay Patel <spatel@rotateright.com>2015-09-02 19:06:43 +0000
committerSanjay Patel <spatel@rotateright.com>2015-09-02 19:06:43 +0000
commita99ab1f5366100824241f410af9c32a434293f50 (patch)
tree5fb6674bd0a6001cde411a14ae30271933bdefd2 /llvm/lib/IR/LLVMContext.cpp
parent63fae0e58b66d7276651c9232b4d9442cce8fc41 (diff)
downloadllvm-a99ab1f5366100824241f410af9c32a434293f50.zip
llvm-a99ab1f5366100824241f410af9c32a434293f50.tar.gz
llvm-a99ab1f5366100824241f410af9c32a434293f50.tar.bz2
add unpredictable metadata type for control flow
This patch defines 'unpredictable' metadata. This metadata can be used to signal to the optimizer or backend that a branch or switch is unpredictable, and therefore, it's probably better to not split a compound predicate into multiple branches such as in CodeGenPrepare::splitBranchCondition(). This was discussed in: https://llvm.org/bugs/show_bug.cgi?id=23827 Dependent patches to alter codegen and expose this in clang to follow. Differential Revision; http://reviews.llvm.org/D12341 llvm-svn: 246688
Diffstat (limited to 'llvm/lib/IR/LLVMContext.cpp')
-rw-r--r--llvm/lib/IR/LLVMContext.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/llvm/lib/IR/LLVMContext.cpp b/llvm/lib/IR/LLVMContext.cpp
index af7609f..77fd3e1 100644
--- a/llvm/lib/IR/LLVMContext.cpp
+++ b/llvm/lib/IR/LLVMContext.cpp
@@ -110,6 +110,12 @@ LLVMContext::LLVMContext() : pImpl(new LLVMContextImpl(*this)) {
assert(MakeImplicitID == MD_make_implicit &&
"make.implicit kind id drifted");
(void)MakeImplicitID;
+
+ // Create the 'unpredictable' metadata kind.
+ unsigned UnpredictableID = getMDKindID("unpredictable");
+ assert(UnpredictableID == MD_unpredictable &&
+ "unpredictable kind id drifted");
+ (void)UnpredictableID;
}
LLVMContext::~LLVMContext() { delete pImpl; }