[PATCH] D109243: [GlobalISel] Build_vector_trunc artifact combine into bitcast

Matt Arsenault via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 8 12:24:29 PDT 2021


arsenm added inline comments.


================
Comment at: llvm/lib/CodeGen/GlobalISel/Legalizer.cpp:111
   case TargetOpcode::G_BUILD_VECTOR:
+  case TargetOpcode::G_BUILD_VECTOR_TRUNC:
   case TargetOpcode::G_EXTRACT:
----------------
Petar.Avramovic wrote:
> arsenm wrote:
> > I'm not sure this is really an artifact. You never strictly need it to link 2 operations together, although you can use it to legalize G_BUILD_VECTOR
> There are already a few artifact combines with G_IMPLICIT_DEF, also build_vector_trunc sounds similar to build_vector so I thought it would be best to deal with it as soon as possible. This way when dealing with <vN  x s16> we pretty much get what will be inst-selected during legalizer. G_BUILD_VECTOR_TRUNC will be lowered using bit shifts in regbankselect if it does not get combined before that point.
> 
> Maybe this belongs in a combiner pass (amdgpu-postlegalizer)?
Yes, this looks just like an optimization to me. I'm not seeing how this improves legality


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

https://reviews.llvm.org/D109243



More information about the llvm-commits mailing list