summaryrefslogtreecommitdiffstats
path: root/llvm/test/Transforms/InstSimplify
diff options
context:
space:
mode:
authorSanjay Patel <spatel@rotateright.com>2019-12-15 09:32:03 -0500
committerSanjay Patel <spatel@rotateright.com>2019-12-15 09:32:03 -0500
commit6080387f136af5a51bbc310abb08c7158d7cd9d2 (patch)
tree1ccdd02183bb684d7fb2e99249ff8e5e870875a2 /llvm/test/Transforms/InstSimplify
parent2afe86411847b3305915f536256b8bb877d8a356 (diff)
downloadbcm5719-llvm-6080387f136af5a51bbc310abb08c7158d7cd9d2.tar.gz
bcm5719-llvm-6080387f136af5a51bbc310abb08c7158d7cd9d2.zip
[InstSimplify] fold splat of inserted constant to vector constant
shuf (inselt ?, C, IndexC), undef, <IndexC, IndexC...> --> <C, C...> This is another missing shuffle fold pattern uncovered by the shuffle correctness fix from D70246. The problem was visible in the post-commit thread example, but we managed to overcome the limitation for that particular case with D71220. This is something like the inverse of the previous fix - there we didn't demand the inserted scalar, and here we are only demanding an inserted scalar. Differential Revision: https://reviews.llvm.org/D71488
Diffstat (limited to 'llvm/test/Transforms/InstSimplify')
-rw-r--r--llvm/test/Transforms/InstSimplify/shufflevector.ll12
1 files changed, 3 insertions, 9 deletions
diff --git a/llvm/test/Transforms/InstSimplify/shufflevector.ll b/llvm/test/Transforms/InstSimplify/shufflevector.ll
index 38d605faee5..14c4205f444 100644
--- a/llvm/test/Transforms/InstSimplify/shufflevector.ll
+++ b/llvm/test/Transforms/InstSimplify/shufflevector.ll
@@ -250,9 +250,7 @@ define <2 x float> @PR32872(<2 x float> %x) {
define <5 x i8> @splat_inserted_constant(<4 x i8> %x) {
; CHECK-LABEL: @splat_inserted_constant(
-; CHECK-NEXT: [[INS3:%.*]] = insertelement <4 x i8> [[X:%.*]], i8 42, i64 3
-; CHECK-NEXT: [[SPLAT5:%.*]] = shufflevector <4 x i8> [[INS3]], <4 x i8> undef, <5 x i32> <i32 3, i32 3, i32 3, i32 3, i32 3>
-; CHECK-NEXT: ret <5 x i8> [[SPLAT5]]
+; CHECK-NEXT: ret <5 x i8> <i8 42, i8 42, i8 42, i8 42, i8 42>
;
%ins3 = insertelement <4 x i8> %x, i8 42, i64 3
%splat5 = shufflevector <4 x i8> %ins3, <4 x i8> undef, <5 x i32> <i32 3, i32 3, i32 3, i32 3, i32 3>
@@ -261,9 +259,7 @@ define <5 x i8> @splat_inserted_constant(<4 x i8> %x) {
define <4 x float> @splat_inserted_constant_undef_elt(<4 x float> %x) {
; CHECK-LABEL: @splat_inserted_constant_undef_elt(
-; CHECK-NEXT: [[INS1:%.*]] = insertelement <4 x float> [[X:%.*]], float 1.200000e+01, i32 1
-; CHECK-NEXT: [[SPLAT1:%.*]] = shufflevector <4 x float> [[INS1]], <4 x float> undef, <4 x i32> <i32 1, i32 1, i32 undef, i32 1>
-; CHECK-NEXT: ret <4 x float> [[SPLAT1]]
+; CHECK-NEXT: ret <4 x float> <float 1.200000e+01, float 1.200000e+01, float undef, float 1.200000e+01>
;
%ins1 = insertelement <4 x float> %x, float 12.0, i32 1
%splat1 = shufflevector <4 x float> %ins1, <4 x float> undef, <4 x i32> <i32 1, i32 1, i32 undef, i32 1>
@@ -272,9 +268,7 @@ define <4 x float> @splat_inserted_constant_undef_elt(<4 x float> %x) {
define <2 x i8> @splat_inserted_constant_not_canonical(<3 x i8> %x, <3 x i8> %y) {
; CHECK-LABEL: @splat_inserted_constant_not_canonical(
-; CHECK-NEXT: [[INS2:%.*]] = insertelement <3 x i8> [[X:%.*]], i8 23, i7 2
-; CHECK-NEXT: [[SPLAT2:%.*]] = shufflevector <3 x i8> [[Y:%.*]], <3 x i8> [[INS2]], <2 x i32> <i32 undef, i32 5>
-; CHECK-NEXT: ret <2 x i8> [[SPLAT2]]
+; CHECK-NEXT: ret <2 x i8> <i8 undef, i8 23>
;
%ins2 = insertelement <3 x i8> %x, i8 23, i7 2
%splat2 = shufflevector <3 x i8> %y, <3 x i8> %ins2, <2 x i32> <i32 undef, i32 5>
OpenPOWER on IntegriCloud