1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-24 03:33:20 +01:00
llvm-mirror/test
Benjamin Kramer 0463564612 CodeGenPrepare: Add a transform to turn selects into branches in some cases.
This came up when a change in block placement formed a cmov and slowed down a
hot loop by 50%:

	ucomisd	(%rdi), %xmm0
	cmovbel	%edx, %esi

cmov is a really bad choice in this context because it doesn't get branch
prediction. If we emit it as a branch, an out-of-order CPU can do a better job
(if the branch is predicted right) and avoid waiting for the slow load+compare
instruction to finish. Of course it won't help if the branch is unpredictable,
but those are really rare in practice.

This patch uses a dumb conservative heuristic, it turns all cmovs that have one
use and a direct memory operand into branches. cmovs usually save some code
size, so we disable the transform in -Os mode. In-Order architectures are
unlikely to benefit as well, those are included in the
"predictableSelectIsExpensive" flag.

It would be better to reuse branch probability info here, but BPI doesn't
support select instructions currently. It would make sense to use the same
heuristics as the if-converter pass, which does the opposite direction of this
transform.


Test suite shows a small improvement here and there on corei7-level machines,
but the actual results depend a lot on the used microarchitecture. The
transformation is currently disabled by default and available by passing the
-enable-cgp-select2branch flag to the code generator.

Thanks to Chandler for the initial test case to him and Evan Cheng for providing
me with comments and test-suite numbers that were more stable than mine :)

llvm-svn: 156234
2012-05-05 12:49:22 +00:00
..
Analysis FileCheck-ize tests. 2012-04-24 10:45:44 +00:00
Archive
Assembler Remove old 'grep' lines. 2012-04-08 11:53:54 +00:00
Bindings/Ocaml
Bitcode FileCheckize these testcases. 2012-04-08 11:00:38 +00:00
BugPoint
CodeGen CodeGenPrepare: Add a transform to turn selects into branches in some cases. 2012-05-05 12:49:22 +00:00
DebugInfo X86: Use StackRegister instead of FrameRegister in getFrameIndexReference (to generate debug info for local variables) if stack needs realignment 2012-05-01 15:16:06 +00:00
ExecutionEngine This patch improves the MCJIT runtime dynamic loader by adding new handling 2012-04-12 20:13:57 +00:00
Feature
Instrumentation [tsan] Atomic support for ThreadSanitizer, patch by Dmitry Vyukov 2012-04-27 07:31:53 +00:00
Integer
Linker Remove llvm-ld and llvm-stub (which is only used by llvm-ld). 2012-04-19 19:27:54 +00:00
MC Fix issues with the ARM bl and blx thumb instructions and the J1 and J2 bits 2012-05-03 22:41:56 +00:00
Object
Other Reapply r155682, making constant folding more consistent, with a fix to work 2012-04-27 17:50:22 +00:00
Scripts
TableGen
Transforms Small fix in InstCombineCasts.cpp. Restored "alloca + bitcast" reducing for case when alloca's size is calculated within the "add/sub/... nsw". 2012-05-05 07:09:40 +00:00
Unit
Verifier Remove support for the special 'fast' value for fpmath accuracy for the moment. 2012-04-16 19:39:33 +00:00
YAMLParser Add YAML parser to Support. 2012-04-03 23:09:22 +00:00
CMakeLists.txt Removes json-bench from the test dependencies. 2012-04-20 13:45:49 +00:00
lit.cfg Remove llvm-ld and llvm-stub (which is only used by llvm-ld). 2012-04-19 19:27:54 +00:00
lit.site.cfg.in Revert r153694. It was causing failures in the buildbots. 2012-03-29 23:23:59 +00:00
Makefile Revert r153694. It was causing failures in the buildbots. 2012-03-29 23:23:59 +00:00
Makefile.tests
site.exp.in
TestRunner.sh