Page MenuHomePhabricator

[DAGCombine] Fix a miscompile when reducing BUILD_VECTORs to a shuffle
ClosedPublic

Authored by bogner on Mar 18 2019, 1:13 PM.

Details

Summary

In r311255 we added a case where we split vectors whose elements are
all derived from the same input vector so that we could shuffle it
more efficiently. In doing so, createBuildVecShuffle was taught to
adjust for the fact that all indices would be based off of the first
vector when this happens, but it's possible for the code that checked
that to fire incorrectly if we happen to have a BUILD_VECTOR of
extracts from subvectors and don't hit this new optimization.

Instead of trying to detect if we've split the vector by checking if
we have extracts from the same base vector, we can just pass that
information into createBuildVecShuffle, avoiding the miscompile.

Diff Detail

Repository
rL LLVM

Event Timeline

bogner created this revision.Mar 18 2019, 1:13 PM
Herald added a project: Restricted Project. · View Herald TranscriptMar 18 2019, 1:13 PM
Gerolf added a subscriber: Gerolf.

Looks reasonable. Added more reviewers for second opinions.

paquette accepted this revision.Mar 19 2019, 9:03 AM

This makes a lot more sense than trying to salvage information from extracts. LGTM.

This revision is now accepted and ready to land.Mar 19 2019, 9:03 AM
This revision was automatically updated to reflect the committed changes.