[PATCH] D12341: add unpredictable metadata type for control flow

Sanjay Patel via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 28 14:31:32 PDT 2015


spatel retitled this revision from "add llvm.unpredictable intrinsic and lower it to metadata" to "add unpredictable metadata type for control flow".
spatel updated the summary for this revision.
spatel updated this revision to Diff 33465.
spatel added a comment.

Patch (completely) updated:
It might have been better to abandon and start new, but I thought keeping the comment context would be nice.

In this version, there is no LLVM unpredictable intrinsic - it's just metadata. As promised, the patch becomes much simpler.

The code should match what Kevin B. Smith suggested: unpredictability is measured as a percentage, so 0 (default) means completely predictable and 100 means completely unpredictable. (I started implementing using a 0.0 - 1.0 FP scale before I saw Kevin's suggestion. I don't know if one way is better than the other.)

However, I have not attempted to define/use any threshold level for unpredictability (see TODO comments in the dependent patches) because I'm assuming we'll need a target hook for that, and of course there is no current producer of that sort of metadata. I should have the clang side of this patch posted soon, so you can see how the builtin_unpredictable handling works from C.


http://reviews.llvm.org/D12341

Files:
  docs/LangRef.rst
  include/llvm/IR/IRBuilder.h
  include/llvm/IR/LLVMContext.h
  include/llvm/IR/MDBuilder.h
  lib/IR/LLVMContext.cpp
  lib/IR/MDBuilder.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D12341.33465.patch
Type: text/x-patch
Size: 5764 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150828/5d9f1bc4/attachment.bin>


More information about the llvm-commits mailing list