[PATCH] D71220: [InstCombine] replace shuffle's insertelement operand if inserted scalar is not demanded

Roman Lebedev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 9 12:44:10 PST 2019


lebedev.ri accepted this revision.
lebedev.ri added a comment.
This revision is now accepted and ready to land.

This is legal.

  ----------------------------------------
  define <4 x float> @insert_undemanded_element_op0(<4 x float> %x, <4 x float> %y) {
  %0:
    %ins = insertelement <4 x float> %x, float 42.000000, i32 3
    %s = shufflevector <4 x float> %ins, <4 x float> %y, <4 x i32> { 0, 7, 1, 4 }
    ret <4 x float> %s
  }
  =>
  define <4 x float> @insert_undemanded_element_op0(<4 x float> %x, <4 x float> %y) {
  %0:
    %ins = insertelement <4 x float> %x, float 42.000000, i32 3
    %s = shufflevector <4 x float> %x, <4 x float> %y, <4 x i32> { 0, 7, 1, 4 }
    ret <4 x float> %s
  }
  Transformation seems to be correct!
  
  Summary:
    1 correct transformations
    0 incorrect transformations
    0 errors


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

https://reviews.llvm.org/D71220





More information about the llvm-commits mailing list