summaryrefslogtreecommitdiffstats
path: root/llvm/test/Transforms
diff options
context:
space:
mode:
authorDiana Picus <diana.picus@linaro.org>2019-11-07 13:09:32 +0100
committerDiana Picus <diana.picus@linaro.org>2019-11-12 12:27:09 +0100
commit7f1dcc8952e6a1a4ba918159ab86bd787d584930 (patch)
treeb6e147fd030704f5cb71ba2d50f36fc9a8167874 /llvm/test/Transforms
parent8794f6787685655223be8a029bf51a1565f7a231 (diff)
downloadbcm5719-llvm-7f1dcc8952e6a1a4ba918159ab86bd787d584930.tar.gz
bcm5719-llvm-7f1dcc8952e6a1a4ba918159ab86bd787d584930.zip
[InstCombine] Skip scalable vectors in combineLoadToOperationType
Don't try to canonicalize loads to scalable vector types to loads of integers. This removes one assertion when trying to use a TypeSize as a parameter to DataLayout::isLegalInteger. It does not handle the second part of the function (which looks at bitcasts). This patch also contains a NFC fix for Load Analysis, where a variable initialization that would cause the same assertion is moved closer to its use. This allows us to run the new test for InstCombine without having to teach LocationSize to play nicely with scalable vectors. Differential Revision: https://reviews.llvm.org/D70075
Diffstat (limited to 'llvm/test/Transforms')
-rw-r--r--llvm/test/Transforms/InstCombine/load.ll48
1 files changed, 48 insertions, 0 deletions
diff --git a/llvm/test/Transforms/InstCombine/load.ll b/llvm/test/Transforms/InstCombine/load.ll
index 5129349b394..f2de4ae7951 100644
--- a/llvm/test/Transforms/InstCombine/load.ll
+++ b/llvm/test/Transforms/InstCombine/load.ll
@@ -237,6 +237,42 @@ entry:
ret void
}
+define void @test16-vect(i8* %x, i8* %a, i8* %b, i8* %c) {
+; CHECK-LABEL: @test16-vect(
+; CHECK-NEXT: entry:
+; CHECK-NEXT: [[C_CAST:%.*]] = bitcast i8* [[C:%.*]] to i32*
+; CHECK-NEXT: [[TMP0:%.*]] = bitcast i8* [[X:%.*]] to i32*
+; CHECK-NEXT: [[X11:%.*]] = load i32, i32* [[TMP0]], align 4
+; CHECK-NEXT: [[TMP1:%.*]] = bitcast i8* [[A:%.*]] to i32*
+; CHECK-NEXT: store i32 [[X11]], i32* [[TMP1]], align 4
+; CHECK-NEXT: [[TMP2:%.*]] = bitcast i8* [[B:%.*]] to i32*
+; CHECK-NEXT: store i32 [[X11]], i32* [[TMP2]], align 4
+; CHECK-NEXT: [[TMP3:%.*]] = bitcast i8* [[X]] to i32*
+; CHECK-NEXT: [[X22:%.*]] = load i32, i32* [[TMP3]], align 4
+; CHECK-NEXT: [[TMP4:%.*]] = bitcast i8* [[B]] to i32*
+; CHECK-NEXT: store i32 [[X22]], i32* [[TMP4]], align 4
+; CHECK-NEXT: store i32 [[X22]], i32* [[C_CAST]], align 4
+; CHECK-NEXT: ret void
+;
+entry:
+ %x.cast = bitcast i8* %x to <4 x i8>*
+ %a.cast = bitcast i8* %a to <4 x i8>*
+ %b.cast = bitcast i8* %b to <4 x i8>*
+ %c.cast = bitcast i8* %c to i32*
+
+ %x1 = load <4 x i8>, <4 x i8>* %x.cast
+ store <4 x i8> %x1, <4 x i8>* %a.cast
+ store <4 x i8> %x1, <4 x i8>* %b.cast
+
+ %x2 = load <4 x i8>, <4 x i8>* %x.cast
+ store <4 x i8> %x2, <4 x i8>* %b.cast
+ %x2.cast = bitcast <4 x i8> %x2 to i32
+ store i32 %x2.cast, i32* %c.cast
+
+ ret void
+}
+
+
; Check that in cases similar to @test16 we don't try to rewrite a load when
; its only use is a store but it is used as the pointer to that store rather
; than the value.
@@ -300,3 +336,15 @@ entry:
store %swift.error* %err.res, %swift.error** %err, align 8
ret void
}
+
+; Make sure we don't canonicalize accesses to scalable vectors.
+define void @test20(<vscale x 4 x i8>* %x, <vscale x 4 x i8>* %y) {
+; CHECK-LABEL: @test20(
+; CHECK-NEXT: [[X_LOAD:%.*]] = load <vscale x 4 x i8>, <vscale x 4 x i8>* [[X:%.*]], align 1
+; CHECK-NEXT: store <vscale x 4 x i8> [[X_LOAD]], <vscale x 4 x i8>* [[Y:%.*]], align 1
+; CHECK-NEXT: ret void
+;
+ %x.load = load <vscale x 4 x i8>, <vscale x 4 x i8>* %x, align 1
+ store <vscale x 4 x i8> %x.load, <vscale x 4 x i8>* %y, align 1
+ ret void
+}
OpenPOWER on IntegriCloud