[PATCH] D76983: [InstCombine] Transform extractelement-trunc -> bitcast-extractelement

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Mar 29 06:55:04 PDT 2020


spatel added a comment.

In D76983#1948011 <https://reviews.llvm.org/D76983#1948011>, @dsprenkels wrote:

> However, I still kinda allow really crazy types. Would it be better to just disable this canonicalization for types that don't look nice ? (Are "nice" types somehow even defined?)


That's similar to @lebedev.ri 's question about legality. We have helpers that look at the data-layout to decide if a type is target-friendly/legal:

  bool InstCombiner::shouldChangeType(unsigned FromWidth, unsigned ToWidth)
  bool InstCombiner::shouldChangeType(Type *From, Type *To);

But that doesn't work with vector types (...because the data-layout doesn't specify vector types AFAIK). In this transform, we are not creating any new type except for a bitcast of a vector type. So I don't think we want to limit the transform. Targets/codegen should be able to deal with bitcasts of vector types.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D76983/new/

https://reviews.llvm.org/D76983





More information about the llvm-commits mailing list