This is an archive of the discontinued LLVM Phabricator instance.

[DAG] Remove isVectorClearMaskLegal() check from vector_build dagcombine
ClosedPublic

Authored by mkuper on Sep 15 2016, 1:25 PM.

Details

Summary

This check currently doesn't seem to do anything useful on any in-tree target, and I don't think it makes sense to keep it:
On non-x86, it always evaluates to false, so we never hit the code path that creates the shuffle with zero.
On x86, it just forwards to isShuffleMaskLegal().

It's possible we should be checking isShuffleMaskLegal() for all the shuffles we generate here, but (a) that should not be x86-specific, and (b) I don't see any reason for it to be specific to shuffles with zero.

(Not deleting isVectorClearMaskLegal() itself, since there's one more DAGCombine that uses it.)

Diff Detail

Repository
rL LLVM

Event Timeline

mkuper updated this revision to Diff 71543.Sep 15 2016, 1:25 PM
mkuper retitled this revision from to [DAG] Remove isVectorClearMaskLegal() check from vector_build dagcombine.
mkuper updated this object.
mkuper added a subscriber: llvm-commits.
uweigand edited edge metadata.Sep 16 2016, 4:33 AM

I don't really have any comment on the code changes themselves, but the SystemZ testcase change is fine with me.

I agree that the UsesZeroVector test shouldn't be there but we should probably use a TLI.isShuffleMaskLegal(Mask, InVT1) test and not just blindly combine to a shuffle.

I agree that the UsesZeroVector test shouldn't be there but we should probably use a TLI.isShuffleMaskLegal(Mask, InVT1) test and not just blindly combine to a shuffle.

We already blindly combine to a shuffle in all the other cases, the "blend with 0" case was the only one that had a check. I'm not saying that's necessarily what we should be doing, but I'm not sure I really want to change that behavior right now.
(My main motivation for removing the check is wanting to regularize this before committing D24683, because special-casing zero there would have been much uglier. )

Anyway, I'll try and see if it affects any of our tests.

Anyway, I'll try and see if it affects any of our tests.

I'm not seeing any change in LIT tests from adding the mask legality check for any shuffle - either here or in D24683.
I'd really prefer to make the smaller change here and remove the check for the zero case.

RKSimon accepted this revision.Sep 27 2016, 7:36 AM
RKSimon added a reviewer: RKSimon.

LGTM

This revision is now accepted and ready to land.Sep 27 2016, 7:36 AM

Thanks, Simon!

This revision was automatically updated to reflect the committed changes.