This is an archive of the discontinued LLVM Phabricator instance.

[DAGCombiner] Do not fold truncate(build_vector(..)) if it creates an illegal type
ClosedPublic

Authored by pirama on Mar 17 2020, 12:05 PM.

Details

Summary

It can be the case that a vector type is legal but the corresponding
scalar type is not legal for an architecture (i8 vs. v16i8 on AArch64).
Check if the scalar type created when folding

truncate(build_vector(x,y)) -> build_vector(truncate(x),truncate(y))

is legal if we are running after the type legalizer.

This fixes https://github.com/android/ndk/issues/1207.

Diff Detail

Event Timeline

pirama created this revision.Mar 17 2020, 12:05 PM
RKSimon added inline comments.Mar 18 2020, 3:06 PM
llvm/test/CodeGen/AArch64/dag-combine-trunc-build-vec.ll
54

remove the superfluous attributes + metadata?

pirama updated this revision to Diff 251194.Mar 18 2020, 3:22 PM

Cleanup test.

RKSimon accepted this revision.Mar 20 2020, 5:24 AM

LGTM

llvm/test/CodeGen/AArch64/dag-combine-trunc-build-vec.ll
26

Maybe move this comment above the define like you did below?

This revision is now accepted and ready to land.Mar 20 2020, 5:24 AM
This revision was automatically updated to reflect the committed changes.