1; RUN: opt < %s -instcombine -S
2
3; Make sure that we don't crash when optimizing the vectors of pointers.
4
5target 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-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
6target triple = "x86_64-apple-macosx10.8.0"
7
8%struct.hoge = type { double*, double*, double*, double** }
9
10define void @widget(%struct.hoge* nocapture %arg) nounwind uwtable ssp {
11bb:
12  %tmp = getelementptr inbounds %struct.hoge, %struct.hoge* %arg, i64 0, i32 0
13  br i1 undef, label %bb1, label %bb17
14
15bb1:                                              ; preds = %bb
16  br i1 undef, label %bb2, label %bb3
17
18bb2:                                              ; preds = %bb1
19  br label %bb17
20
21bb3:                                              ; preds = %bb1
22  %tmp4 = bitcast double** %tmp to <2 x double*>*
23  %tmp5 = load <2 x double*>, <2 x double*>* %tmp4, align 8
24  %tmp6 = ptrtoint <2 x double*> %tmp5 to <2 x i64>
25  %tmp7 = sub <2 x i64> zeroinitializer, %tmp6
26  %tmp8 = ashr exact <2 x i64> %tmp7, <i64 3, i64 3>
27  %tmp9 = extractelement <2 x i64> %tmp8, i32 0
28  %tmp10 = add nsw i64 undef, %tmp9
29  br i1 undef, label %bb11, label %bb12
30
31bb11:                                             ; preds = %bb3
32  br label %bb13
33
34bb12:                                             ; preds = %bb3
35  br label %bb13
36
37bb13:                                             ; preds = %bb12, %bb11
38  br i1 undef, label %bb16, label %bb14
39
40bb14:                                             ; preds = %bb13
41  br i1 undef, label %bb16, label %bb15
42
43bb15:                                             ; preds = %bb14
44  br label %bb16
45
46bb16:                                             ; preds = %bb15, %bb14, %bb13
47  unreachable
48
49bb17:                                             ; preds = %bb2, %bb
50  ret void
51}
52