llvm/lib
Sanjay Patel 8bd59f505a [x86] generalize reassociation optimization in machine combiner to 2 instructions
Currently ( D10321, http://reviews.llvm.org/rL239486 ), we can use the machine combiner pass
to reassociate the following sequence to reduce the critical path:

A = ? op ?
B = A op X
C = B op Y
-->
A = ? op ?
B = X op Y
C = A op B

'op' is currently limited to x86 AVX scalar FP adds (with fast-math on), but in theory, it could
be any associative math/logic op (see TODO in code comment).

This patch generalizes the pattern match to ignore the instruction that defines 'A'. So instead of
a sequence of 3 adds, we now only need to find 2 dependent adds and decide if it's worth
reassociating them.

This generalization has a compile-time cost because we can now match more instruction sequences
and we rely more heavily on the machine combiner to discard sequences where reassociation doesn't
improve the critical path.

For example, in the new test case:

A = M div N
B = A add X
C = B add Y

We'll match 2 reassociation patterns, but this transform doesn't reduce the critical path:

A = M div N
B = A add Y
C = B add X

We need the combiner to reject that pattern but select this:

A = M div N
B = X add Y
C = B add A

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@240361 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-23 00:39:40 +00:00
..
Analysis [PM/AA] Hoist the AliasResult enum out of the AliasAnalysis class. 2015-06-22 02:16:51 +00:00
AsmParser Fixed/added namespace ending comments using clang-tidy. NFC 2015-06-19 15:57:42 +00:00
Bitcode Remove the IsStreamed member variable. 2015-06-22 18:06:15 +00:00
CodeGen [x86] generalize reassociation optimization in machine combiner to 2 instructions 2015-06-23 00:39:40 +00:00
DebugInfo Try to fix generation of LLVMExports.cmake under Visual Studio. 2015-06-19 21:50:27 +00:00
ExecutionEngine Fix line endings (NFC) 2015-06-22 21:37:34 +00:00
Fuzzer [lib/Fuzzer] make assertions more informative and update comments for the user-supplied mutator 2015-05-30 17:33:13 +00:00
IR Fixed/added namespace ending comments using clang-tidy. NFC 2015-06-19 15:57:42 +00:00
IRReader Return a unique_ptr from getLazyBitcodeModule and parseBitcodeFile. NFC. 2015-06-16 22:27:55 +00:00
LibDriver Modify ParseArgs to return the InputArgList by value - there's no need for dynamic allocation/ownership here 2015-06-22 22:06:37 +00:00
LineEditor
Linker Linker: Do not expect comdat to exist in source module. 2015-06-22 21:46:51 +00:00
LTO Return a unique_ptr from getLazyBitcodeModule and parseBitcodeFile. NFC. 2015-06-16 22:27:55 +00:00
MC Fix PR23914. 2015-06-22 23:36:03 +00:00
Object [Object] Search for architecures by name in MachOUniversalBinary::getObjectForArch() 2015-06-22 21:33:24 +00:00
Option Code cleanup: Remove std::move() around xvalue (NFC) 2015-06-22 23:16:02 +00:00
Passes [PM] Fixup for r231556 where I missed a dependency on intrinsics 2015-03-07 09:08:20 +00:00
ProfileData Re-apply "InstrProf: When reading, copy the data instead of taking a reference. NFC" 2015-06-22 23:58:05 +00:00
Support Fixed/added namespace ending comments using clang-tidy. NFC 2015-06-19 15:57:42 +00:00
TableGen Fixed/added namespace ending comments using clang-tidy. NFC 2015-06-19 15:57:42 +00:00
Target [x86] generalize reassociation optimization in machine combiner to 2 instructions 2015-06-23 00:39:40 +00:00
Transforms [LoopDist] Improve variable names and comments in LoopVersioning class, NFC 2015-06-22 22:59:40 +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