1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt < %s -sroa -S | FileCheck %s
3 target datalayout = "E-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-n32:64-S128"
4 target triple = "sparcv9-sun-solaris"
7 ; Check that we don't crash on this test.
12 ; CHECK-NEXT: [[RC:%.*]] = add i16 2, 2
13 ; CHECK-NEXT: ret i16 [[RC]]
17 ; This 12-byte alloca is split into partitions as [0,2), [2,4), [4,8), [8,10), [10, 12).
18 ; The reported error happened when rewriteIntegerStore try to widen a split tail of slice 1 for [4, 8) partition.
25 %a.3 = alloca [6 x i16], align 1
27 %_tmp3 = getelementptr inbounds [6 x i16], [6 x i16]* %a.3, i16 0, i16 1
28 %_tmp5 = bitcast i16* %_tmp3 to i32*
29 store i32 131074, i32* %_tmp5, align 1
31 %_tmp8 = getelementptr inbounds [6 x i16], [6 x i16]* %a.3, i16 0, i16 4
32 %_tmp10 = bitcast i16* %_tmp8 to i32*
33 store i32 131074, i32* %_tmp10, align 1
35 %_tmp12 = getelementptr inbounds [6 x i16], [6 x i16]* %a.3, i16 0, i16 4
36 %_tmp13 = load i16, i16* %_tmp12, align 1
38 %_tmp15 = getelementptr inbounds [6 x i16], [6 x i16]* %a.3, i16 0, i16 1
39 %_tmp16 = load i16, i16* %_tmp15, align 1
41 %rc = add i16 %_tmp13, %_tmp16
48 ; CHECK-NEXT: [[A_3_SROA_2_2_INSERT_EXT:%.*]] = zext i16 undef to i32
49 ; CHECK-NEXT: [[A_3_SROA_2_2_INSERT_MASK:%.*]] = and i32 undef, -65536
50 ; CHECK-NEXT: [[A_3_SROA_2_2_INSERT_INSERT:%.*]] = or i32 [[A_3_SROA_2_2_INSERT_MASK]], [[A_3_SROA_2_2_INSERT_EXT]]
51 ; CHECK-NEXT: [[A_3_SROA_0_2_INSERT_EXT:%.*]] = zext i16 undef to i32
52 ; CHECK-NEXT: [[A_3_SROA_0_2_INSERT_SHIFT:%.*]] = shl i32 [[A_3_SROA_0_2_INSERT_EXT]], 16
53 ; CHECK-NEXT: [[A_3_SROA_0_2_INSERT_MASK:%.*]] = and i32 [[A_3_SROA_2_2_INSERT_INSERT]], 65535
54 ; CHECK-NEXT: [[A_3_SROA_0_2_INSERT_INSERT:%.*]] = or i32 [[A_3_SROA_0_2_INSERT_MASK]], [[A_3_SROA_0_2_INSERT_SHIFT]]
55 ; CHECK-NEXT: [[RC:%.*]] = add i16 2, undef
56 ; CHECK-NEXT: ret i16 [[RC]]
60 ; This 12-byte alloca is split into partitions as [0,2), [2,4), [4,8), [8,10), [10, 12).
61 ; The reported error happened when visitLoadInst rewrites a split tail of slice 1 for [4, 8) partition.
68 %a.3 = alloca [6 x i16], align 1
70 %_tmp3 = getelementptr inbounds [6 x i16], [6 x i16]* %a.3, i16 0, i16 1
71 %_tmp5 = bitcast i16* %_tmp3 to i32*
72 %_tmp6 = load i32, i32* %_tmp5, align 1
74 %_tmp8 = getelementptr inbounds [6 x i16], [6 x i16]* %a.3, i16 0, i16 4
75 %_tmp10 = bitcast i16* %_tmp8 to i32*
76 store i32 131074, i32* %_tmp10, align 1
78 %_tmp12 = getelementptr inbounds [6 x i16], [6 x i16]* %a.3, i16 0, i16 4
79 %_tmp13 = load i16, i16* %_tmp12, align 1
81 %_tmp15 = getelementptr inbounds [6 x i16], [6 x i16]* %a.3, i16 0, i16 1
82 %_tmp16 = load i16, i16* %_tmp15, align 1
84 %rc = add i16 %_tmp13, %_tmp16