summaryrefslogtreecommitdiffstats
path: root/llvm/test/Transforms/SROA/slice-width.ll
diff options
context:
space:
mode:
authorYunzhong Gao <Yunzhong_Gao@playstation.sony.com>2014-08-22 23:27:04 +0000
committerYunzhong Gao <Yunzhong_Gao@playstation.sony.com>2014-08-22 23:27:04 +0000
commit300bdb35d45d35758f9a09d46acc0b33d4a5785b (patch)
treeae21595755c5e09d2209643763260a9abd59c338 /llvm/test/Transforms/SROA/slice-width.ll
parentf7ecb1157226f078264ced1d6d9b2fe5802c8486 (diff)
downloadbcm5719-llvm-300bdb35d45d35758f9a09d46acc0b33d4a5785b.tar.gz
bcm5719-llvm-300bdb35d45d35758f9a09d46acc0b33d4a5785b.zip
Add a test case for SROA where the store size is bigger than slice size. The
test case was fixed in r216248. llvm-svn: 216303
Diffstat (limited to 'llvm/test/Transforms/SROA/slice-width.ll')
-rw-r--r--llvm/test/Transforms/SROA/slice-width.ll34
1 files changed, 34 insertions, 0 deletions
diff --git a/llvm/test/Transforms/SROA/slice-width.ll b/llvm/test/Transforms/SROA/slice-width.ll
index dc56e5390e5..ff66dcccee4 100644
--- a/llvm/test/Transforms/SROA/slice-width.ll
+++ b/llvm/test/Transforms/SROA/slice-width.ll
@@ -70,3 +70,37 @@ define void @memset_fp80_padding() {
; CHECK: alloca x86_fp80
; CHECK: call void @llvm.memset.p0i8.i32(i8* %{{.*}}, i8 -1, i32 16, i32 16, i1 false)
; CHECK: store i64 -1, i64* @i64_sink
+
+%S.vec3float = type { float, float, float }
+%U.vec3float = type { <4 x float> }
+
+declare i32 @memcpy_vec3float_helper(%S.vec3float*)
+
+define i32 @memcpy_vec3float_widening(%S.vec3float* %x) {
+; CHECK-LABEL: @memcpy_vec3float_widening(
+; PR18726: Check that SROA does not rewrite a 12-byte memcpy into a 16-byte
+; vector store, hence accidentally putting gibberish onto the stack.
+entry:
+ ; Create a temporary variable %tmp1 and copy %x[0] into it
+ %tmp1 = alloca %S.vec3float, align 4
+ %0 = bitcast %S.vec3float* %tmp1 to i8*
+ %1 = bitcast %S.vec3float* %x to i8*
+ call void @llvm.memcpy.p0i8.p0i8.i32(i8* %0, i8* %1, i32 12, i32 4, i1 false)
+
+ ; The following block does nothing; but appears to confuse SROA
+ %unused1 = bitcast %S.vec3float* %tmp1 to %U.vec3float*
+ %unused2 = getelementptr inbounds %U.vec3float* %unused1, i32 0, i32 0
+ %unused3 = load <4 x float>* %unused2, align 1
+
+ ; Create a second temporary and copy %tmp1 into it
+ %tmp2 = alloca %S.vec3float, align 4
+ %2 = bitcast %S.vec3float* %tmp2 to i8*
+ %3 = bitcast %S.vec3float* %tmp1 to i8*
+; CHECK: alloca
+; CHECK-NOT: store <4 x float>
+ call void @llvm.memcpy.p0i8.p0i8.i32(i8* %2, i8* %3, i32 12, i32 4, i1 false)
+
+ %result = call i32 @memcpy_vec3float_helper(%S.vec3float* %tmp2)
+ ret i32 %result
+; CHECK: ret i32 %result
+}
OpenPOWER on IntegriCloud