This is an archive of the discontinued LLVM Phabricator instance.

DAG: Match truncated rotation (PR35487)
ClosedPublic

Authored by hans on Dec 4 2017, 10:25 AM.

Details

Summary

If the truncation has been pushed past the or-node, look through it and truncate afterwards.

Diff Detail

Repository
rL LLVM

Event Timeline

hans created this revision.Dec 4 2017, 10:25 AM
hans added a reviewer: bogner.Dec 4 2017, 10:48 AM
hans added a reviewer: escha.Dec 4 2017, 10:51 AM
escha edited edge metadata.Dec 4 2017, 11:04 AM

LGTM, though it'd be interesting to see if there's any other cases where (FOO (ROTATE pattern) [...]) gets torn apart besides FOO == truncate.

escha accepted this revision.Dec 4 2017, 11:08 AM
This revision is now accepted and ready to land.Dec 4 2017, 11:08 AM
scanon accepted this revision.Dec 4 2017, 11:09 AM

Yup, there's likely something more general that we could match, but it's also worth taking this as is.

efriedma added inline comments.
lib/CodeGen/SelectionDAG/DAGCombiner.cpp
4657 ↗(On Diff #125365)

Do you need to check that LHS.getOperand(0).getValueType() == RHS.getOperand(0).getValueType()?

This revision was automatically updated to reflect the committed changes.
hans added inline comments.Dec 4 2017, 12:42 PM
lib/CodeGen/SelectionDAG/DAGCombiner.cpp
4657 ↗(On Diff #125365)

Sorry, just hit commit before I saw this. You're right, I need to check that.

hans added inline comments.Dec 4 2017, 12:49 PM
lib/CodeGen/SelectionDAG/DAGCombiner.cpp
4657 ↗(On Diff #125365)

r319695