DAGCombiner: Improve DAGCombiner select normalization
authorMatthias Braun <matze@braunis.de>
Tue, 18 Aug 2015 20:48:36 +0000 (20:48 +0000)
committerMatthias Braun <matze@braunis.de>
Tue, 18 Aug 2015 20:48:36 +0000 (20:48 +0000)
commit9329447cf40261f568fb91374e26476c4898a440
tree491c1c01e1792b2e8f8476549334030190ecdf49
parent1c81ad149de69dd1c53146a3587b536f279d2a58
DAGCombiner: Improve DAGCombiner select normalization

The current code normalizes select(C0, x, select(C1, x, y)) towards
select(C0|C1, x, y) if the targets prefers that form. This patch adds an
additional rule that if the select(C1, x, y) part already exists in the
function then we want to normalize into the other direction because the
effects of reusing the existing value are bigger than transforming into
the target preferred form.

This addresses regressions following r238793, see also:
http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20150727/290272.html

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245350 91177308-0d34-0410-b5e6-96231b3b80d8
lib/CodeGen/SelectionDAG/DAGCombiner.cpp
test/CodeGen/AArch64/dag-combine-select.ll