llvm-project/llvm/lib
Cong Hou 551a57f797 Allow X86::COND_NE_OR_P and X86::COND_NP_OR_E to be reversed.
Currently, AnalyzeBranch() fails non-equality comparison between floating points
on X86 (see https://llvm.org/bugs/show_bug.cgi?id=23875). This is because this
function can modify the branch by reversing the conditional jump and removing
unconditional jump if there is a proper fall-through. However, in the case of
non-equality comparison between floating points, this can turn the branch
"unanalyzable". Consider the following case:

jne.BB1
jp.BB1
jmp.BB2
.BB1:
...
.BB2:
...

AnalyzeBranch() will reverse "jp .BB1" to "jnp .BB2" and then "jmp .BB2" will be
removed:

jne.BB1
jnp.BB2
.BB1:
...
.BB2:
...

However, AnalyzeBranch() cannot analyze this branch anymore as there are two
conditional jumps with different targets. This may disable some optimizations
like block-placement: in this case the fall-through behavior is enforced even if
the fall-through block is very cold, which is suboptimal.

Actually this optimization is also done in block-placement pass, which means we
can remove this optimization from AnalyzeBranch(). However, currently
X86::COND_NE_OR_P and X86::COND_NP_OR_E are not reversible: there is no defined
negation conditions for them.

In order to reverse them, this patch defines two new CondCode X86::COND_E_AND_NP
and X86::COND_P_AND_NE. It also defines how to synthesize instructions for them.
Here only the second conditional jump is reversed. This is valid as we only need
them to do this "unconditional jump removal" optimization.


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

llvm-svn: 258847
2016-01-26 20:08:01 +00:00
..
Analysis [LIR] Add support for structs and hand unrolled loops 2016-01-26 02:27:47 +00:00
AsmParser Implemented Support of IA interrupt and exception handlers: 2015-12-21 14:07:14 +00:00
Bitcode Fix Clang-tidy modernize-use-nullptr and modernize-use-override warnings; other minor fixes. 2016-01-26 18:48:36 +00:00
CodeGen [ScheduleDAGInstrs] Simplify logic to improve readability. NFC. 2016-01-26 19:33:57 +00:00
DebugInfo Re-submit r256008 "Improve DWARFDebugFrame::parse to also handle __eh_frame." 2016-01-26 15:09:42 +00:00
ExecutionEngine Reflect the MC/MCDisassembler split on the include/ level. 2016-01-26 16:44:37 +00:00
Fuzzer Temporary disable broken fuzzer/timeout tests. 2016-01-25 19:05:45 +00:00
IR Use binary search for intrinsic ID lookups 2016-01-26 02:06:41 +00:00
IRReader [ThinLTO] Metadata linking for imported functions 2015-12-17 17:14:09 +00:00
LTO [LTO] Fix error reporting when a file passed to libLTO is invalid or non-existent 2016-01-20 09:03:42 +00:00
LibDriver [Option] Use an ArrayRef to store the Option Infos in OptTable. NFC 2015-10-21 16:30:42 +00:00
LineEditor
Linker [ThinLTO] Find all needed metadata when linking metadata as postpass 2016-01-25 22:04:56 +00:00
MC Reflect the MC/MCDisassembler split on the include/ level. 2016-01-26 16:44:37 +00:00
Object [Object][COFF] Revert r258665 - It doesn't do what I had intended. 2016-01-25 01:21:45 +00:00
Option Convert Arg, ArgList, and Option to dump() to dbgs() rather than errs(). 2015-12-18 18:55:26 +00:00
Passes [attrs] Extract the pure inference of function attributes into 2015-12-27 08:41:34 +00:00
ProfileData Fix Clang-tidy modernize-use-nullptr and modernize-use-override warnings; other minor fixes. 2016-01-26 18:48:36 +00:00
Support Fix Clang-tidy modernize-use-nullptr and modernize-use-override warnings; other minor fixes. 2016-01-26 18:48:36 +00:00
TableGen [TableGen] Use FoldingSets instead of DenseMaps to unique UnOpInit, BinOpInit and TernOpInit. This remove the memory needed to store the key for the DenseMap. NFC 2016-01-18 20:36:06 +00:00
Target Allow X86::COND_NE_OR_P and X86::COND_NP_OR_E to be reversed. 2016-01-26 20:08:01 +00:00
Transforms Fix Clang-tidy modernize-use-nullptr and modernize-use-override warnings; other minor fixes. 2016-01-26 18:48:36 +00:00
CMakeLists.txt LibDriver, llvm-lib: introduce. 2015-06-09 21:50:22 +00:00
LLVMBuild.txt Wrap some long lines in LLVMBuild files. NFC 2015-06-12 18:44:57 +00:00
Makefile LibDriver, llvm-lib: introduce. 2015-06-09 21:50:22 +00:00