This is an archive of the discontinued LLVM Phabricator instance.

[PatternMatch] add special-case uaddo matching for increment-by-one
ClosedPublic

Authored by spatel on Jan 31 2019, 8:07 AM.

Details

Summary

This is the most important uaddo problem mentioned in PR31754:
https://bugs.llvm.org/show_bug.cgi?id=31754

We were failing to match the canonicalized pattern when it's an 'add 1' operation.
Pattern matching, however, shouldn't assume that we have canonicalized IR, so we match 4 commuted variants of uaddo.

There's also a test with a crazy type to show that the existing CGP transform based on this matcher is not limited by target legality checks.

Diff Detail

Event Timeline

spatel created this revision.Jan 31 2019, 8:07 AM
RKSimon accepted this revision.Jan 31 2019, 8:22 AM

LGTM

This revision is now accepted and ready to land.Jan 31 2019, 8:22 AM
spatel updated this revision to Diff 184526.Jan 31 2019, 9:25 AM
spatel added a subscriber: kparzysz.

(Not sure what's going on with Phab updates - but I haven't seen mails for commits corresponding to this review.)

Patch updated:
I forgot to update existing regression tests for this change.
I was worried that the existing code wasn't restricted enough, and the x86 diffs show that? Ie, using add 1 rather than inc should be considered a regression. I don't know what to make of the Hexagon diff (cc @kparzysz ).

...but there's a twist: I just saw D57520 would cause the same set of extra diffs that I neglected to include here originally. What is going on here?

This revision was automatically updated to reflect the committed changes.
spatel reopened this revision.Jan 31 2019, 10:01 AM

Reopening - I reverted the initial commit: rL352769

This revision is now accepted and ready to land.Jan 31 2019, 10:01 AM
spatel updated this revision to Diff 184542.Jan 31 2019, 10:15 AM
spatel added a reviewer: niravd.

Re-uploading the same patch as I mentioned in the previous comment (the one with all of the affected regression tests) because Phab is showing the version that committed initially.

@craig.topper Are you OK with the INC - ADD changes?

@craig.topper Are you OK with the INC - ADD changes?

Yeah. I imagine it won't be too hard to add a combine to recover it.

@craig.topper Are you OK with the INC - ADD changes?

Yeah. I imagine it won't be too hard to add a combine to recover it.

Thanks - my first hack at that doesn't account for all the test diffs, but I haven't messed around with those EFLAGS combines much before, so I might've misplaced the fold.
There's still a question about the Hexagon test regardless of whether we're ok with the x86 diffs.

RKSimon accepted this revision.Feb 1 2019, 11:32 AM

LGTM - if you can expand the test checks for swp-epilog-phi5.ll (not necessarily running the update script) that'd be great

This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptFeb 3 2019, 8:16 AM