1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-25 20:23:11 +01:00
Go to file
Andrea Di Biagio 64b0da84f4 [CodeGenPrepare] Teach when it is profitable to speculate calls to @llvm.cttz/ctlz.
If the control flow is modelling an if-statement where the only instruction in
the 'then' basic block (excluding the terminator) is a call to cttz/ctlz,
CodeGenPrepare can try to speculate the cttz/ctlz call and simplify the control
flow graph.

Example:
\code
entry:
  %cmp = icmp eq i64 %val, 0
  br i1 %cmp, label %end.bb, label %then.bb

then.bb:
  %c = tail call i64 @llvm.cttz.i64(i64 %val, i1 true)
  br label %end.bb

end.bb:
  %cond = phi i64 [ %c, %then.bb ], [ 64, %entry]
\code

In this example, basic block %then.bb is taken if value %val is not zero.
Also, the phi node in %end.bb would propagate the size-of in bits of %val
only if %val is equal to zero.

With this patch, CodeGenPrepare will try to hoist the call to cttz from %then.bb
into basic block %entry only if cttz is cheap to speculate for the target.

Added two new hooks in TargetLowering.h to let targets customize the behavior
(i.e. decide whether it is cheap or not to speculate calls to cttz/ctlz). The
two new methods are 'isCheapToSpeculateCtlz' and 'isCheapToSpeculateCttz'.
By default, both methods return 'false'.
On X86, method 'isCheapToSpeculateCtlz' returns true only if the target has
LZCNT. Method 'isCheapToSpeculateCttz' only returns true if the target has BMI.

Differential Revision: http://reviews.llvm.org/D6728

llvm-svn: 224899
2014-12-28 11:07:35 +00:00
autoconf Require python 2.7. 2014-12-12 15:29:31 +00:00
bindings [OCaml] Expose Llvm_executionengine.get_{global_value,function}_address. 2014-12-24 01:52:51 +00:00
cmake [cmake] Unbreak LLVM-Config.cmake / llvm_expand_dependencies. 2014-12-18 23:56:52 +00:00
docs Documentation for Masked Load and Store intrinsics. 2014-12-25 09:29:13 +00:00
examples Once more on the cmake build. nativecodegen->native on the dependencies. 2014-12-08 18:24:06 +00:00
include [CodeGenPrepare] Teach when it is profitable to speculate calls to @llvm.cttz/ctlz. 2014-12-28 11:07:35 +00:00
lib [CodeGenPrepare] Teach when it is profitable to speculate calls to @llvm.cttz/ctlz. 2014-12-28 11:07:35 +00:00
projects [cmake] Use the external project machinery for libcxxabi so that it can 2014-07-25 10:27:40 +00:00
test [CodeGenPrepare] Teach when it is profitable to speculate calls to @llvm.cttz/ctlz. 2014-12-28 11:07:35 +00:00
tools Another attempt to fix the LLVM Windows build bot lld-x86_64-win7, one last place to fix I think. 2014-12-24 00:16:51 +00:00
unittests Fix a leak found by asan. 2014-12-23 17:20:23 +00:00
utils Masked Load/Store - Changed the order of parameters in intrinsics. 2014-12-25 07:49:20 +00:00
.arcconfig Updated phabricator server. 2014-04-07 03:57:04 +00:00
.clang-format
.clang-tidy Enable display of compiler diagnostics in clang-tidy by default. 2014-10-29 17:29:38 +00:00
.gitignore Initial version of Go bindings. 2014-10-16 22:48:02 +00:00
CMakeLists.txt Adding a new option to CMake to disable C++ atexit on llvm-shlib. 2014-12-09 18:49:55 +00:00
CODE_OWNERS.TXT Add myself as SystemZ code owner 2014-12-18 19:27:50 +00:00
configure Require python 2.7. 2014-12-12 15:29:31 +00:00
CREDITS.TXT Rise from the dead and update personal info 2014-08-25 17:51:04 +00:00
LICENSE.TXT Remove projects/sample. 2014-03-12 22:40:22 +00:00
llvm.spec.in
LLVMBuild.txt
Makefile [configure/make] Propagate names of build host tools when making BuildTools 2014-03-25 21:45:41 +00:00
Makefile.common
Makefile.config.in Add a check for misbehaving -Wcomment from gcc-4.7 and add 2014-11-05 00:35:15 +00:00
Makefile.rules Add a check for misbehaving -Wcomment from gcc-4.7 and add 2014-11-05 00:35:15 +00:00
README.txt [TEST-COMMIT] As per Developer Policy, Added a blank line. 2014-12-06 00:38:39 +00:00

Low Level Virtual Machine (LLVM)
================================

This directory and its subdirectories contain source code for the Low Level
Virtual Machine, a toolkit for the construction of highly optimized compilers,
optimizers, and runtime environments.

LLVM is open source software. You may freely distribute it under the terms of
the license agreement found in LICENSE.txt.

Please see the documentation provided in docs/ for further
assistance with LLVM, and in particular docs/GettingStarted.rst for getting
started with LLVM and docs/README.txt for an overview of LLVM's
documentation setup.

If you're writing a package for LLVM, see docs/Packaging.rst for our
suggestions.