[PATCH] D44997: [InstCombine] Fold compare of int constant against an integer vector splat

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 30 08:24:03 PDT 2018


spatel added a comment.

The matching seems narrower than required. It won't catch cases where we splat some existing vector element (rather than a scalar value). Can we start the match from the shuffle instead:

  %splat = shufflevector <M x iN> %x, <4 x iN> undef, <4 x i32> <i32 C, i32 C, i32 C, i32 C>
  %cast = bitcast <M x iN> %splat to iMN
  %cond = icmp Pred iMN %cast, SplatCmpC
   

And create this:

  %ext = extractelement <4 x iN> %x, i32 C
  %cond = icmp Pred iN %ext, CmpC

If there's an insertelement ahead of the extractelement, existing folds should take care of eliminating that.


Repository:
  rL LLVM

https://reviews.llvm.org/D44997





More information about the llvm-commits mailing list