llvm-project/llvm/lib
Haicheng Wu c7cc87922e [JumpThreading] Don't select an edge that we know we can't thread
In r312664 (D36404), JumpThreading stopped threading edges into
loop headers. Unfortunately, I observed a significant performance
regression as a result of this change. Upon further investigation,
the problematic pattern looked something like this (after
many high level optimizations):

while (true) {
    bool cond = ...;
    if (!cond) {
        <body>
    }
    if (cond)
        break;
}

Now, naturally we want jump threading to essentially eliminate the
second if check and hook up the edges appropriately. However, the
above mentioned change, prevented it from doing this because it would
have to thread an edge into the loop header.

Upon further investigation, what is happening is that since both branches
are threadable, JumpThreading picks one of them at arbitrarily. In my
case, because of the way that the IR ended up, it tended to pick
the one to the loop header, bailing out immediately after. However,
if it had picked the one to the exit block, everything would have
worked out fine (because the only remaining branch would then be folded,
not thraded which is acceptable).

Thus, to fix this problem, we can simply eliminate loop headers from
consideration as possible threading targets earlier, to make sure that
if there are multiple eligible branches, we can still thread one of
the ones that don't target a loop header.

Patch by Keno Fischer!
Differential Revision: https://reviews.llvm.org/D42260

llvm-svn: 328798
2018-03-29 16:01:26 +00:00
..
Analysis [NFC] Fix meaningless assert in SCEV 2018-03-29 07:54:59 +00:00
AsmParser [SimplifyCFG] Create attribute for fuzzing-specific optimizations. 2018-03-22 17:07:51 +00:00
BinaryFormat Fix build broken by r328090 2018-03-21 12:18:03 +00:00
Bitcode [SimplifyCFG] Create attribute for fuzzing-specific optimizations. 2018-03-22 17:07:51 +00:00
CodeGen Plumb useAA through TargetTransformInfo to remove Transforms->CodeGen header dependency 2018-03-28 22:28:50 +00:00
DebugInfo .debug_names: Correctly align the AugmentationStringSize field 2018-03-29 15:12:45 +00:00
Demangle [demangler] Fix a bug in r328464 found by oss-fuzz. 2018-03-26 15:34:36 +00:00
ExecutionEngine [ORC] Fix ORC on platforms without indirection support. 2018-03-28 03:41:45 +00:00
FuzzMutate [llvm-opt-fuzzer] Add irce to the fuzzing options 2018-03-20 11:32:13 +00:00
Fuzzer [libFuzzer] Delete llvm/lib/Fuzzer 2017-10-16 20:48:19 +00:00
IR [LLVM-C] Finish exception instruction bindings 2018-03-29 03:43:15 +00:00
IRReader LLParser: add an argument for overriding data layout and do not check alloca addr space 2018-01-30 22:32:39 +00:00
LTO Move TargetLoweringObjectFile from CodeGen to Target to fix layering 2018-03-23 23:58:19 +00:00
LineEditor
Linker [ThinLTO] Recommit of import global variables 2018-03-12 10:30:50 +00:00
MC Revert "Reapply "[DWARFv5] Emit file 0 to the line table."" 2018-03-28 12:36:46 +00:00
Object [llvm-ar] Support multiple dashed options 2018-03-28 17:21:14 +00:00
ObjectYAML Reland "[DebugInfo] Support DWARF expressions in eh_frame" 2018-03-08 00:46:53 +00:00
Option [NFC] Replace iterators in PrintHelp with range-based for 2018-03-12 18:31:07 +00:00
Passes Fix Layering, move instrumentation transform headers into Instrumentation subdirectory 2018-03-23 22:11:06 +00:00
ProfileData Revert "Revert "[InstrProf] Support for external functions in text format."" 2018-03-22 21:26:52 +00:00
Support [YAML] Escape non-printable multibyte UTF8 in Output::scalarString. 2018-03-27 19:52:45 +00:00
TableGen TableGen: Remove redundant loop in ListInit::resolveReferences 2018-03-21 17:13:10 +00:00
Target [Hexagon] Add support to handle bit-reverse load intrinsics 2018-03-29 13:52:46 +00:00
Testing Force #define GTEST_LANG_CXX11. 2017-10-27 21:12:28 +00:00
ToolDrivers [COFF] Keep the underscore on exported decorated stdcall functions in MSVC mode 2018-01-20 11:44:32 +00:00
Transforms [JumpThreading] Don't select an edge that we know we can't thread 2018-03-29 16:01:26 +00:00
WindowsManifest Fix bug 34608 by moving private header out of public header. 2017-09-14 23:01:13 +00:00
XRay [XRay] clarify error messages when parsing broken traces 2018-01-30 13:41:34 +00:00
CMakeLists.txt
LLVMBuild.txt