This is an archive of the discontinued LLVM Phabricator instance.

[DAGCombiner] Bail out if vector size is not a multiple
ClosedPublic

Authored by svenvh on Jan 22 2018, 8:28 AM.

Details

Summary

For the included test case, visitCONCAT_VECTORS would attempt to
create a v2i32 vector for a v9i8 concat_vector. Bail out to avoid
creating a bitcast with mismatching sizes later on.

Diff Detail

Repository
rL LLVM

Event Timeline

svenvh created this revision.Jan 22 2018, 8:28 AM
RKSimon added inline comments.Jan 22 2018, 8:32 AM
lib/CodeGen/SelectionDAG/DAGCombiner.cpp
15191 ↗(On Diff #130902)

"Bail out if the output vector size is not a multiple of the input vector size."

Shouldn't this be pulled out to near the top of the method?

FoldCONCAT_VECTORS actually treats this as an assert - is there anyway that you can cause it to fire there?

svenvh added inline comments.Jan 22 2018, 9:18 AM
lib/CodeGen/SelectionDAG/DAGCombiner.cpp
15191 ↗(On Diff #130902)

Not sure if "input vector size" is correct here; we want the output vector size to be a multiple of the scalar size that we input to scalar_to_vector. We only know the scalar size around this point in the code (after deciding whether to look through the trunc).

The concat_vector in itself is fine; which assert in FoldCONCAT_VECTORS do you expect to fire?

RKSimon accepted this revision.Jan 23 2018, 5:58 AM

Sorry, but I misread your change - I've gone through it properly now and LGTM

This revision is now accepted and ready to land.Jan 23 2018, 5:58 AM
This revision was automatically updated to reflect the committed changes.