llvm-6502/lib/CodeGen/SelectionDAG
Sanjay Patel 959b276771 transform fadd chains to increase parallelism
This is a compromise: with this simple patch, we should always handle a chain of exactly 3
operations optimally, but we're not generating the optimal balanced binary tree for a longer
sequence.

In general, this transform will reduce the dependency chain for a sequence of instructions
using N operands from a worst case N-1 dependent operations to N/2 dependent operations. 
The optimal balanced binary tree would reduce the chain to log2(N).

The trade-off for not dealing with longer sequences is: (1) we have less complexity in the
compiler, (2) we avoid unknown compile-time blowup calculating a balanced tree, and (3) we
don't need to worry about the increased register pressure required to parallelize longer
sequences. It also seems unlikely that we would ever encounter really long strings of
dependent ops like that in the wild, but I'm not sure how to verify that speculation.
FWIW, I see no perf difference for test-suite running on btver2 (x86-64) with -ffast-math
and this patch.

We can extend this patch to cover other associative operations such as fmul, fmax, fmin, 
integer add, integer mul.

This is a partial fix for:
https://llvm.org/bugs/show_bug.cgi?id=17305

and if extended:
https://llvm.org/bugs/show_bug.cgi?id=21768
https://llvm.org/bugs/show_bug.cgi?id=23116

The issue also came up in:
http://reviews.llvm.org/D8941

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236031 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-28 21:03:22 +00:00
..
CMakeLists.txt
DAGCombiner.cpp transform fadd chains to increase parallelism 2015-04-28 21:03:22 +00:00
FastISel.cpp [patchpoint] Add support for symbolic patchpoint targets to SelectionDAG and the 2015-04-22 06:02:31 +00:00
FunctionLoweringInfo.cpp [SEH] Implement GetExceptionCode in __except blocks 2015-04-24 20:25:05 +00:00
InstrEmitter.cpp [InlineAsm] Remove EarlyClobber on registers that are also inputs 2015-04-20 00:01:30 +00:00
InstrEmitter.h
LegalizeDAG.cpp Reapply r235977 "[DebugInfo] Add debug locations to constant SD nodes" 2015-04-28 14:05:47 +00:00
LegalizeFloatTypes.cpp Reapply r235977 "[DebugInfo] Add debug locations to constant SD nodes" 2015-04-28 14:05:47 +00:00
LegalizeIntegerTypes.cpp Reapply r235977 "[DebugInfo] Add debug locations to constant SD nodes" 2015-04-28 14:05:47 +00:00
LegalizeTypes.cpp Reapply r235977 "[DebugInfo] Add debug locations to constant SD nodes" 2015-04-28 14:05:47 +00:00
LegalizeTypes.h Add support to promote f16 to f32 2015-04-17 18:36:25 +00:00
LegalizeTypesGeneric.cpp Reapply r235977 "[DebugInfo] Add debug locations to constant SD nodes" 2015-04-28 14:05:47 +00:00
LegalizeVectorOps.cpp Reapply r235977 "[DebugInfo] Add debug locations to constant SD nodes" 2015-04-28 14:05:47 +00:00
LegalizeVectorTypes.cpp Reapply r235977 "[DebugInfo] Add debug locations to constant SD nodes" 2015-04-28 14:05:47 +00:00
LLVMBuild.txt
Makefile
ResourcePriorityQueue.cpp unique_ptrify ResourcePriorityQueue::ResourceModel 2015-03-03 20:49:08 +00:00
ScheduleDAGFast.cpp
ScheduleDAGRRList.cpp Use 'override/final' instead of 'virtual' for overridden methods 2015-04-11 02:11:45 +00:00
ScheduleDAGSDNodes.cpp
ScheduleDAGSDNodes.h Use 'override/final' instead of 'virtual' for overridden methods 2015-04-11 02:11:45 +00:00
ScheduleDAGVLIW.cpp Use 'override/final' instead of 'virtual' for overridden methods 2015-04-11 02:11:45 +00:00
SDNodeDbgValue.h
SelectionDAG.cpp move IR-level optimization flags into their own struct 2015-04-28 16:39:12 +00:00
SelectionDAGBuilder.cpp Reapply r235977 "[DebugInfo] Add debug locations to constant SD nodes" 2015-04-28 14:05:47 +00:00
SelectionDAGBuilder.h Masked gather and scatter: Added code for SelectionDAG. 2015-04-28 07:57:37 +00:00
SelectionDAGDumper.cpp DebugInfo: Gut DIScope, DIEnumerator and DISubrange 2015-04-16 01:37:00 +00:00
SelectionDAGISel.cpp Reapply r235977 "[DebugInfo] Add debug locations to constant SD nodes" 2015-04-28 14:05:47 +00:00
SelectionDAGPrinter.cpp
StatepointLowering.cpp Reapply r235977 "[DebugInfo] Add debug locations to constant SD nodes" 2015-04-28 14:05:47 +00:00
StatepointLowering.h
TargetLowering.cpp Reapply r235977 "[DebugInfo] Add debug locations to constant SD nodes" 2015-04-28 14:05:47 +00:00
TargetSelectionDAGInfo.cpp