This is an archive of the discontinued LLVM Phabricator instance.

[DAGCombine] Improve handling of insert_subvector of bitcast values
ClosedPublic

Authored by niravd on Jun 23 2017, 1:45 PM.

Details

Summary

Add variations on existing optimizations that deal with bitcasts in operands. Fixes regressions from X86's post-legalization store merge change.

Event Timeline

niravd created this revision.Jun 23 2017, 1:45 PM
RKSimon added a subscriber: RKSimon.

Waiting on test cases.

craig.topper added inline comments.Jun 26 2017, 10:01 PM
lib/CodeGen/SelectionDAG/DAGCombiner.cpp
15872

"If we N0"?

15885

Period on the end of the comment.

15894

No space between "bit" and "cast" to match the comment above?

It turns out generating the failing case for this nontrivial as it looks like we canot irectly build a insertsubvector /extract subvector node.

The peephole of note is along the lines of:

insertsubvector (insertsubvector undef (extractsubvector (bitcast x) 0) 0) (extract subvector (bitcast x) (subvectorsize)) subvectorsize

becoming :

(bitcast x)

Rather than push on this here, I'm going to flip the dependence with D34559 which will now have a small degradation that this patch will fix.

niravd updated this revision to Diff 104211.Jun 27 2017, 10:35 AM

Comment cleanup

niravd updated this revision to Diff 104325.Jun 27 2017, 5:37 PM
niravd edited the summary of this revision. (Show Details)

Rebase and move after X86 post-legalization store merge to provide test cases.

RKSimon added inline comments.Jul 4 2017, 7:56 AM
lib/CodeGen/SelectionDAG/DAGCombiner.cpp
15874

N0.getOpcode()

niravd updated this revision to Diff 108518.Jul 27 2017, 1:24 PM
niravd marked 4 inline comments as done.

Resolve comments.

niravd updated this revision to Diff 108938.Jul 31 2017, 9:09 AM

Unfold unrelated commit.

niravd updated this revision to Diff 108940.EditedJul 31 2017, 9:12 AM

Undo unrelated updated.

RKSimon accepted this revision.Aug 1 2017, 5:26 AM

LGTM

This revision is now accepted and ready to land.Aug 1 2017, 5:26 AM

@niravd Anything stopping this going in?

This revision was automatically updated to reflect the committed changes.