[PATCH] D12341: add llvm.unpredictable intrinsic and lower it to metadata

Sanjay Patel via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 25 14:54:44 PDT 2015


spatel created this revision.
spatel added reviewers: hfinkel, chandlerc, kparzysz.
spatel added a subscriber: llvm-commits.

This is an LLVM patch to create an llvm.unpredictable intrinsic call. This intrinsic 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

Most of this patch is just renaming the existing "LowerExpectIntrinsic" to the more general "LowerPredictionIntrinsic". I have two small follow-on patches (to CodeGenPrepare and SelectionDAGBuilder) that will use the metadata when deciding to split branch conditions. There's also a small patch to clang to make this available in C.


http://reviews.llvm.org/D12341

Files:
  bindings/ocaml/transforms/scalar_opts/llvm_scalar_opts.mli
  bindings/ocaml/transforms/scalar_opts/scalar_opts_ocaml.c
  docs/LangRef.rst
  include/llvm-c/Transforms/Scalar.h
  include/llvm/IR/Intrinsics.td
  include/llvm/IR/LLVMContext.h
  include/llvm/InitializePasses.h
  include/llvm/LinkAllPasses.h
  include/llvm/Transforms/Scalar.h
  include/llvm/Transforms/Scalar/LowerExpectIntrinsic.h
  include/llvm/Transforms/Scalar/LowerPredictionIntrinsic.h
  lib/CodeGen/IntrinsicLowering.cpp
  lib/CodeGen/SelectionDAG/FastISel.cpp
  lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
  lib/IR/LLVMContext.cpp
  lib/Passes/PassBuilder.cpp
  lib/Passes/PassRegistry.def
  lib/Transforms/IPO/PassManagerBuilder.cpp
  lib/Transforms/Scalar/CMakeLists.txt
  lib/Transforms/Scalar/LowerExpectIntrinsic.cpp
  lib/Transforms/Scalar/LowerPredictionIntrinsic.cpp
  lib/Transforms/Scalar/Scalar.cpp
  test/Transforms/LowerExpectIntrinsic/basic.ll
  test/Transforms/LowerExpectIntrinsic/unpredictable.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D12341.33127.patch
Type: text/x-patch
Size: 39873 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150825/b92132f5/attachment.bin>


More information about the llvm-commits mailing list