add 'MustReduceDepth' as an objective/cost-metric for the MachineCombiner
authorSanjay Patel <spatel@rotateright.com>
Tue, 10 Nov 2015 16:48:53 +0000 (16:48 +0000)
committerSanjay Patel <spatel@rotateright.com>
Tue, 10 Nov 2015 16:48:53 +0000 (16:48 +0000)
commit76d9fb3a148bd33f4378aece787dec62882689e8
treee382d57f4dde85d61e564ec3fdd5102845483620
parent20538780aed942110e6b9b775f78a0748ec9f210
add 'MustReduceDepth' as an objective/cost-metric for the MachineCombiner

This is one of the problems noted in PR25016:
https://llvm.org/bugs/show_bug.cgi?id=25016
and:
http://lists.llvm.org/pipermail/llvm-dev/2015-October/090998.html

The spilling problem is independent and not addressed by this patch.

The MachineCombiner was doing reassociations that don't improve or even worsen the critical path.
This is caused by inclusion of the "slack" factor when calculating the critical path of the original
code sequence. If we don't add that, then we have a more conservative cost comparison of the old code
sequence vs. a new sequence. The more liberal calculation must be preserved, however, for the AArch64
MULADD patterns because benchmark regressions were observed without that.

The two failing test cases now have identical asm that does what we want:
a + b + c + d ---> (a + b) + (c + d)

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252616 91177308-0d34-0410-b5e6-96231b3b80d8
lib/CodeGen/MachineCombiner.cpp
test/CodeGen/X86/machine-combiner.ll