This is an archive of the discontinued LLVM Phabricator instance.

[TargetLowering] Add UNDEF folding to SimplifyDemandedVectorElts
ClosedPublic

Authored by RKSimon on Dec 10 2018, 6:55 AM.

Details

Summary

If all the demanded elements of the SimplifyDemandedVectorElts are known to be undef we can simplify to an ISD::UNDEF node.

This exposes an issue with a recursive DAGCombiner::visitINSERT_SUBVECTOR call if the inner node deletes a node then the outer depends upon. I've only been able to expose this with the SimplifyDemandedVectorElts change so will keep it as part of this patch (I'm happy to submit it as a pre-commit however - it causes no lit test changes so seems pretty superfluous).

ZERO constant folding will handled in a future patch - its a little trickier as we often have bitcasted zero values.

Diff Detail

Repository
rL LLVM

Event Timeline

RKSimon created this revision.Dec 10 2018, 6:55 AM
niravd accepted this revision.Dec 10 2018, 9:55 AM

LGTM. Removing the insert_subvector nesting transform is especially nice. I think it's fine to go in as is even before the zero forwarding, but I'll defer to others.

This revision is now accepted and ready to land.Dec 10 2018, 9:55 AM
This revision was automatically updated to reflect the committed changes.