This is an archive of the discontinued LLVM Phabricator instance.

[DAGCombiner] Leverage add's commutativity
ClosedPublic

Authored by deadalnix on Feb 4 2017, 6:02 AM.

Details

Summary

This avoid the need to duplicate all pattern and actually end up exposing some opportunity to optimize existing pattern that did not exists in both directions on an existing test case.

Diff Detail

Repository
rL LLVM

Event Timeline

deadalnix created this revision.Feb 4 2017, 6:02 AM
RKSimon added inline comments.Feb 4 2017, 1:19 PM
lib/CodeGen/SelectionDAG/DAGCombiner.cpp
1795 ↗(On Diff #87093)

Why not replace SDNode *LocReference by const SDLoc &DL?

deadalnix added inline comments.Feb 4 2017, 3:37 PM
lib/CodeGen/SelectionDAG/DAGCombiner.cpp
1795 ↗(On Diff #87093)

I followed the pattern that is used for other visitFOOLike . Also having the node available maybe come up handy if other information are required in the future. I was some factorization could be done between this and visitADDC.

RKSimon accepted this revision.Feb 5 2017, 4:56 AM

LGTM

This revision is now accepted and ready to land.Feb 5 2017, 4:56 AM
This revision was automatically updated to reflect the committed changes.