[PATCH] D48893: [Constants, InstCombine] allow RHS (operand 1) identity constants for binops

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 4 05:16:55 PDT 2018


spatel added a comment.

In https://reviews.llvm.org/D48893#1151840, @nlopes wrote:

> `shl %x, undef` is poison; we don't want more undefs :)
>  So this transformation for shifts is not correct. The way to make it correct would be to introduce a `poison` value and use it in the shuffle instructions instead of undef. I suggest we finally go ahead and do that.




1. Does the 'undef' in the shuffle mask represent something different than the 'undef' in the shift amount?
2. Are we distinguishing shifts from the other binary opcodes here? Or is this existing transform also incorrect?

  %b = mul nsw nuw <4 x i32> %v, <i32 11, i32 12, i32 13, i32 14>
  %s = shufflevector <4 x i32> %v, <4 x i32> %b, <4 x i32> <i32 undef, i32 5, i32 2, i32 7>
  -->
  %s = mul nuw nsw <4 x i32> [[V:%.*]], <i32 undef, i32 12, i32 1, i32 14>


https://reviews.llvm.org/D48893





More information about the llvm-commits mailing list