blob: c3fbdf5f86322d975fc42facfcea6096cb8fbfe4 [file] [log] [blame]
Dan Gohmane106aee2011-07-21 23:30:09 +00001; RUN: opt -scalarrepl -S < %s | FileCheck %s
2; rdar://9786827
3
4; SROA should be able to handle the mixed types and eliminate the allocas here.
5
6; TODO: Currently it does this by falling back to integer "bags of bits".
7; With enough cleverness, it should be possible to convert between <3 x i32>
8; and <2 x i64> by using a combination of a bitcast and a shuffle.
9
10; CHECK: {
11; CHECK-NOT: alloca
12; CHECK: }
13
14target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128-n8:16:32"
15target triple = "i386-apple-darwin11.0.0"
16
17define <2 x i64> @foo() nounwind {
18entry:
19 %retval = alloca <3 x i32>, align 16
20 %z = alloca <4 x i32>, align 16
21 %tmp = load <4 x i32>* %z
22 %tmp1 = shufflevector <4 x i32> %tmp, <4 x i32> undef, <3 x i32> <i32 0, i32 1, i32 2>
23 store <3 x i32> %tmp1, <3 x i32>* %retval
24 %0 = bitcast <3 x i32>* %retval to <2 x i64>*
25 %1 = load <2 x i64>* %0, align 1
26 ret <2 x i64> %1
27}