]> granicus.if.org Git - llvm/commit
[LegalizeTypes] When promoting the result of EXTRACT_SUBVECTOR, also check if the...
authorCraig Topper <craig.topper@intel.com>
Fri, 22 Feb 2019 01:49:50 +0000 (01:49 +0000)
committerCraig Topper <craig.topper@intel.com>
Fri, 22 Feb 2019 01:49:50 +0000 (01:49 +0000)
commit696f3bcb586eb21bc092b8f71c66b830d555c801
tree7956d4b80516d815387cee7ce8b798f08b16cc65
parent611058ce019d64316be81264815ff48a8d792b6b
[LegalizeTypes] When promoting the result of EXTRACT_SUBVECTOR, also check if the input needs to be promoted. Use that to determine the element type to extract.

Otherwise we end up creating extract_vector_elts that then each need to have their input promoted. This can lead to truncates needing to be emitted for each of those.

But we already emitted any_extends when we legalized the extract_subvector. So now we have pairs of any_extend+trunc that partially cancel. But depending on how DAGCombiner visits them we can get weird results.

By promoting the input at the same time we can create only a single any_extend or truncate.

There's one regression in the vector-narrow-binop.ll case, but that looks easy to fix with a follow up patch.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@354647 91177308-0d34-0410-b5e6-96231b3b80d8
lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp
test/CodeGen/X86/2011-12-28-vselecti8.ll
test/CodeGen/X86/pr35918.ll
test/CodeGen/X86/vector-narrow-binop.ll