[PATCH] D24381: [InstCombine] Convert shuffle with single constant vector element to insertelement.

Alexey Bataev via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 19 08:21:47 PDT 2016


ABataev added inline comments.

================
Comment at: test/Transforms/InstCombine/insert-const-shuf.ll:16-29
@@ -15,14 +15,16 @@
 
 ; A chain of inserts should collapse.
 
 define <4 x float> @twoInserts(<4 x float> %x) {
 ; CHECK-LABEL: @twoInserts(
-; CHECK-NEXT:    [[INS2:%.*]] = shufflevector <4 x float> %x, <4 x float> <float undef, float 0.000000e+00, float 4.200000e+01, float 1.100000e+01>, <4 x i32> <i32 0, i32 5, i32 6, i32 7>
+; CHECK-NEXT:    [[SHUF1:%.*]] = insertelement <4 x float> %x, float 0.000000e+00, i32 1
+; CHECK-NEXT:    [[INS1:%.*]] = insertelement <4 x float> [[SHUF1]], float 4.200000e+01, i32 2
+; CHECK-NEXT:    [[INS2:%.*]] = insertelement <4 x float> [[INS1]], float 1.100000e+01, i32 3
 ; CHECK-NEXT:    ret <4 x float> [[INS2]]
 ;
   %shuf = shufflevector <4 x float> %x, <4 x float> zeroinitializer, <4 x i32> <i32 0, i32 5, i32 6, i32 3>
   %ins1 = insertelement <4 x float> %shuf, float 42.0, i32 2
   %ins2 = insertelement <4 x float> %ins1, float 11.0, i32 3
   ret <4 x float> %ins2
 }
 
----------------
spatel wrote:
> As-is, this patch will cause a regression here (ie, the chain of inserts does not collapse). But D24182 will fix this? If it's not possible to separate these two patches without causing a regression, then they should be merged together. I'm not able to apply D24182 cleanly after applying this patch, so it may be that something is just not updated?
Yes, D24182 is not updated yet. Yes, it is not possible to separate these 2 patches without this kind of regression. Do you really want to join these 2 patches into one?


https://reviews.llvm.org/D24381





More information about the llvm-commits mailing list