Page MenuHomePhabricator

InstCombine: Combine select sequences into a single select
ClosedPublic

Authored by MatzeB on Feb 5 2015, 4:00 PM.

Details

Reviewers
hfinkel
Summary

Normalize
select(C0, select(C1, a, b), b) -> select((C0 & C1), a, b)
select(C0, a, select(C1, a, b)) -> select((C0 | C1), a, b)

This form may enabled further combines on the And and Or part
conditions. For most targets the select sequence is actually preferable
though, a followup patch will change DAGCombine to go back to the previous
form.

Diff Detail

Repository
rL LLVM

Event Timeline

MatzeB updated this revision to Diff 19441.Feb 5 2015, 4:00 PM
MatzeB retitled this revision from to InstCombine: Combine select sequences into a single select.
MatzeB updated this object.
MatzeB edited the test plan for this revision. (Show Details)
MatzeB set the repository for this revision to rL LLVM.
MatzeB added a subscriber: Unknown Object (MLST).
hfinkel accepted this revision.Feb 6 2015, 5:29 AM
hfinkel added a reviewer: hfinkel.
hfinkel added a subscriber: hfinkel.

LGTM.

lib/Transforms/InstCombine/InstCombineSelect.cpp
1190

The other reason this helps, which I think is worth mentioning, is that GetUnderlyingObjects (which is used both at the IR level proper in several places, and also used on MMOs by the instruction scheduler) only looks back through a fixed number of PHIs and selects. Thus, reducing the select depth makes several things more powerful "for free".

This revision is now accepted and ready to land.Feb 6 2015, 5:29 AM
MatzeB closed this revision.Feb 6 2015, 2:59 PM

Committed in r228409