Page MenuHomePhabricator

[DAGCombine] More diamond carry pattern optimization.
Needs ReviewPublic

Authored by deadalnix on Jan 27 2019, 9:48 AM.

Details

Summary

This diff improve the capability of DAGCOmbine to generate linear carries propagation in presence of a diamond pattern. It is now able to match a large variety of different patterns rather than some hardcoded one.

Arguably, the codegen in test cases is not better, but this is to be expected. The goal of this transformation is more about canonicalisation than actual optimisation.

Diff Detail

Event Timeline

deadalnix created this revision.Jan 27 2019, 9:48 AM
deadalnix retitled this revision from [DAGCombine] More diamong carry pattern optimization. to [DAGCombine] More diamond carry pattern optimization..Jan 27 2019, 9:52 AM

Fix NewY's type which was invalid in some circustances

craig.topper added inline comments.Jan 28 2019, 4:56 PM
lib/CodeGen/SelectionDAG/DAGCombiner.cpp
2681

usualy->usually

2682

linarized->linearized

2726

fnd->find

deadalnix updated this revision to Diff 184009.Jan 28 2019, 7:34 PM

Fix typos.
Rebase on top of D57367

deadalnix updated this revision to Diff 190035.Mar 10 2019, 6:28 PM

Remove dependency on D57367 as now it show improvement on existing test cases.

Herald added a project: Restricted Project. · View Herald TranscriptMar 10 2019, 6:28 PM
RKSimon added inline comments.Mar 11 2019, 3:14 AM
lib/CodeGen/SelectionDAG/DAGCombiner.cpp
2677

ddamoni ? paternq?

2757

Don't use auto

2762

Instead of 'DoIt' - would it be better to move this into a lambda and just call it in each of the cases above?

test/CodeGen/X86/subcarry.ll
107

Whats your plan to deal with this regression?

deadalnix updated this revision to Diff 190081.Mar 11 2019, 6:56 AM
deadalnix marked an inline comment as done.
  • rebase
  • Fix types
  • Remove unnecessary use of auto
  • Use a lambda
deadalnix added inline comments.Mar 11 2019, 7:02 AM
test/CodeGen/X86/subcarry.ll
107

It may seems counter intuitive, but this is regression is maybe the main motivation behind that patch. The code previously had 2 carries propagation, and now it has one. This new form is not as good independently, but can be optimized.

See D57317 and D59208 for instance.

deadalnix updated this revision to Diff 193196.Mon, Apr 1, 4:19 PM

Rebase and ping.