1 ; RUN: opt < %s -loop-vectorize -force-vector-unroll=2 -force-vector-width=8 -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-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
4 target triple = "x86_64-apple-macosx"
6 @b = common global i32 0, align 4
7 @f = common global i32 0, align 4
8 @a = common global i32 0, align 4
9 @d = common global i32* null, align 8
10 @e = common global i32* null, align 8
11 @c = common global i32 0, align 4
13 ; CHECK-LABEL-LABEL: @fn1(
15 define void @fn1() #0 {
19 for.cond: ; preds = %for.cond, %entry
20 %i.0 = phi i32 [ undef, %entry ], [ %inc, %for.cond ]
21 %cmp = icmp slt i32 %i.0, 0
22 %call = tail call i32 @fn2(double fadd (double fsub (double undef, double undef), double 1.000000e+00)) #2
23 %inc = add nsw i32 %i.0, 1
24 br i1 %cmp, label %for.cond, label %for.cond4.preheader
26 for.cond4.preheader: ; preds = %for.cond
27 %call.lcssa = phi i32 [ %call, %for.cond ]
28 %cmp514 = icmp sgt i32 %call.lcssa, 0
29 br i1 %cmp514, label %for.cond7.preheader.lr.ph, label %for.end26
31 for.cond7.preheader.lr.ph: ; preds = %for.cond4.preheader
32 %0 = load i32** @e, align 8, !tbaa !0
33 br label %for.cond7.preheader
35 for.cond7.preheader: ; preds = %for.cond7.preheader.lr.ph, %for.inc23
36 %y.017 = phi i32 [ 0, %for.cond7.preheader.lr.ph ], [ %inc24, %for.inc23 ]
37 %i.116 = phi i32 [ 0, %for.cond7.preheader.lr.ph ], [ %i.2.lcssa, %for.inc23 ]
38 %n.015 = phi i32 [ undef, %for.cond7.preheader.lr.ph ], [ %inc25, %for.inc23 ]
39 %1 = load i32* @b, align 4, !tbaa !3
40 %tobool11 = icmp eq i32 %1, 0
41 br i1 %tobool11, label %for.inc23, label %for.body8.lr.ph
43 for.body8.lr.ph: ; preds = %for.cond7.preheader
44 %add9 = add i32 %n.015, 1
47 for.body8: ; preds = %for.body8.lr.ph, %for.inc19
48 %indvars.iv19 = phi i64 [ 0, %for.body8.lr.ph ], [ %indvars.iv.next20, %for.inc19 ]
49 %i.213 = phi i32 [ %i.116, %for.body8.lr.ph ], [ 0, %for.inc19 ]
50 %2 = trunc i64 %indvars.iv19 to i32
51 %add10 = add i32 %add9, %2
52 store i32 %add10, i32* @f, align 4, !tbaa !3
53 %idx.ext = sext i32 %add10 to i64
54 %add.ptr = getelementptr inbounds i32* @a, i64 %idx.ext
55 %tobool129 = icmp eq i32 %i.213, 0
56 br i1 %tobool129, label %for.inc19, label %for.body13.lr.ph
58 for.body13.lr.ph: ; preds = %for.body8
59 %3 = sext i32 %i.213 to i64
62 for.body13: ; preds = %for.body13.lr.ph, %for.body13
63 %indvars.iv = phi i64 [ %3, %for.body13.lr.ph ], [ %indvars.iv.next, %for.body13 ]
64 %add.ptr.sum = add i64 %idx.ext, %indvars.iv
65 %arrayidx = getelementptr inbounds i32* @a, i64 %add.ptr.sum
66 %4 = load i32* %arrayidx, align 4, !tbaa !3
67 %arrayidx15 = getelementptr inbounds i32* %0, i64 %indvars.iv
68 store i32 %4, i32* %arrayidx15, align 4, !tbaa !3
69 %indvars.iv.next = add i64 %indvars.iv, 1
70 %5 = trunc i64 %indvars.iv.next to i32
71 %tobool12 = icmp eq i32 %5, 0
72 br i1 %tobool12, label %for.cond11.for.inc19_crit_edge, label %for.body13
74 for.cond11.for.inc19_crit_edge: ; preds = %for.body13
77 for.inc19: ; preds = %for.cond11.for.inc19_crit_edge, %for.body8
78 %6 = load i32* @c, align 4, !tbaa !3
79 %inc20 = add nsw i32 %6, 1
80 store i32 %inc20, i32* @c, align 4, !tbaa !3
81 %indvars.iv.next20 = add i64 %indvars.iv19, 1
82 %7 = load i32* @b, align 4, !tbaa !3
83 %tobool = icmp eq i32 %7, 0
84 br i1 %tobool, label %for.cond7.for.inc23_crit_edge, label %for.body8
86 for.cond7.for.inc23_crit_edge: ; preds = %for.inc19
87 %add.ptr.lcssa = phi i32* [ %add.ptr, %for.inc19 ]
88 store i32* %add.ptr.lcssa, i32** @d, align 8, !tbaa !0
91 for.inc23: ; preds = %for.cond7.for.inc23_crit_edge, %for.cond7.preheader
92 %i.2.lcssa = phi i32 [ 0, %for.cond7.for.inc23_crit_edge ], [ %i.116, %for.cond7.preheader ]
93 %inc24 = add nsw i32 %y.017, 1
94 %inc25 = add nsw i32 %n.015, 1
95 %exitcond = icmp ne i32 %inc24, %call.lcssa
96 br i1 %exitcond, label %for.cond7.preheader, label %for.cond4.for.end26_crit_edge
98 for.cond4.for.end26_crit_edge: ; preds = %for.inc23
101 for.end26: ; preds = %for.cond4.for.end26_crit_edge, %for.cond4.preheader
104 declare i32 @fn2(double) #1
106 attributes #0 = { nounwind ssp uwtable "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf"="true" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "unsafe-fp-math"="false" "use-soft-float"="false" }
107 attributes #1 = { "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf"="true" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "unsafe-fp-math"="false" "use-soft-float"="false" }
109 !0 = metadata !{metadata !"int", metadata !1}
110 !1 = metadata !{metadata !"omnipotent char", metadata !2}
111 !2 = metadata !{metadata !"Simple C/C++ TBAA"}
112 !3 = metadata !{metadata !"double", metadata !1}
113 !4 = metadata !{metadata !"any pointer", metadata !1}