This is an archive of the discontinued LLVM Phabricator instance.

[DAGCombiner] When folding (insert_subvector undef, (bitcast (extract_subvector N1, Idx)), Idx) -> (bitcast N1) make sure that N1 has the same total size as the original output
ClosedPublic

Authored by craig.topper on Feb 1 2018, 11:56 AM.

Details

Summary

We were only checking the element count, but not the total width. This could cause illegal bitcasts to be created if for example the output was 512-bits, but N1 is 256 bits, and the extraction size was 128-bits.

Fixes PR36199

Diff Detail

Repository
rL LLVM

Event Timeline

craig.topper created this revision.Feb 1 2018, 11:56 AM
niravd accepted this revision.Feb 1 2018, 12:03 PM

LGTM.

This revision is now accepted and ready to land.Feb 1 2018, 12:03 PM
This revision was automatically updated to reflect the committed changes.