1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2; RUN: opt < %s -passes=sroa -S | FileCheck %s
3target datalayout = "e-p:64:64:64:32"
4
5%struct.test = type { %struct.basic, %struct.basic }
6%struct.basic = type { i16, i8 }
7
8define i16 @test(ptr %ts2.i) {
9; CHECK-LABEL: @test(
10; CHECK-NEXT:  entry:
11; CHECK-NEXT:    [[S_SROA_0:%.*]] = alloca [3 x i8], align 8
12; CHECK-NEXT:    [[TMP0:%.*]] = bitcast ptr [[TS2_I:%.*]] to ptr
13; CHECK-NEXT:    call void @llvm.memcpy.p0.p0.i32(ptr align 1 [[TMP0]], ptr align 8 [[S_SROA_0]], i32 3, i1 false)
14; CHECK-NEXT:    [[TMP1:%.*]] = load i16, ptr [[TS2_I]], align 2
15; CHECK-NEXT:    ret i16 [[TMP1]]
16;
17entry:
18  %s = alloca %struct.test
19  %0 = bitcast ptr %ts2.i to ptr
20  %1 = bitcast ptr %s to ptr
21  call void @llvm.memcpy.p0.p0.i32(ptr %0, ptr %1, i32 3, i1 false)
22  %2 = load i16, ptr %ts2.i
23  ret i16 %2
24}
25
26declare void @llvm.memcpy.p0.p0.i32(ptr nocapture writeonly, ptr nocapture readonly, i32, i1)
27