This is an archive of the discontinued LLVM Phabricator instance.

DAGCombiner: Improve DAGCombiner select normalization
ClosedPublic

Authored by MatzeB on Jul 29 2015, 5:27 PM.

Details

Summary
  • Optimize SELECTs first before folding them into SELECT_CC:

This lets us catch a few more cases to optimize.

  • Use CSE opportunities before looking at target preferences:

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

Diff Detail

Repository
rL LLVM

Event Timeline

MatzeB updated this revision to Diff 30973.Jul 29 2015, 5:27 PM
MatzeB retitled this revision from to DAGCombiner: Improve DAGCombiner select normalization.
MatzeB updated this object.
MatzeB set the repository for this revision to rL LLVM.
MatzeB added a subscriber: llvm-commits.
hfinkel accepted this revision.Aug 10 2015, 1:29 AM
hfinkel added a reviewer: hfinkel.
hfinkel added a subscriber: hfinkel.

LGTM.

This revision is now accepted and ready to land.Aug 10 2015, 1:29 AM
aadg added a subscriber: aadg.Aug 14 2015, 6:15 AM

Hi Matthias,

We have checked the regressions are now gone with this patch, so feel free to commit.

Cheers,
Arnaud

This revision was automatically updated to reflect the committed changes.