Sanjay Patel | b653de1 | 2014-09-10 17:58:16 +0000 | [diff] [blame] | 1 | ; RUN: opt < %s -loop-vectorize -force-vector-interleave=2 -force-vector-width=8 -S | FileCheck %s |
Andrew Trick | 0ae8c94f | 2013-07-13 06:20:06 +0000 | [diff] [blame] | 2 | |
| 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" |
Andrew Trick | 0ae8c94f | 2013-07-13 06:20:06 +0000 | [diff] [blame] | 4 | |
| 5 | @b = common global i32 0, align 4 |
| 6 | @f = common global i32 0, align 4 |
| 7 | @a = common global i32 0, align 4 |
| 8 | @d = common global i32* null, align 8 |
| 9 | @e = common global i32* null, align 8 |
| 10 | @c = common global i32 0, align 4 |
| 11 | |
Matt Arsenault | e64c7c7 | 2013-10-02 20:29:00 +0000 | [diff] [blame] | 12 | ; CHECK-LABEL: @fn1( |
Andrew Trick | 0ae8c94f | 2013-07-13 06:20:06 +0000 | [diff] [blame] | 13 | ; CHECK: vector.body |
| 14 | define void @fn1() #0 { |
| 15 | entry: |
| 16 | br label %for.cond |
| 17 | |
| 18 | for.cond: ; preds = %for.cond, %entry |
| 19 | %i.0 = phi i32 [ undef, %entry ], [ %inc, %for.cond ] |
| 20 | %cmp = icmp slt i32 %i.0, 0 |
| 21 | %call = tail call i32 @fn2(double fadd (double fsub (double undef, double undef), double 1.000000e+00)) #2 |
| 22 | %inc = add nsw i32 %i.0, 1 |
| 23 | br i1 %cmp, label %for.cond, label %for.cond4.preheader |
| 24 | |
| 25 | for.cond4.preheader: ; preds = %for.cond |
| 26 | %call.lcssa = phi i32 [ %call, %for.cond ] |
| 27 | %cmp514 = icmp sgt i32 %call.lcssa, 0 |
| 28 | br i1 %cmp514, label %for.cond7.preheader.lr.ph, label %for.end26 |
| 29 | |
| 30 | for.cond7.preheader.lr.ph: ; preds = %for.cond4.preheader |
David Blaikie | a79ac14 | 2015-02-27 21:17:42 +0000 | [diff] [blame] | 31 | %0 = load i32*, i32** @e, align 8, !tbaa !4 |
Andrew Trick | 0ae8c94f | 2013-07-13 06:20:06 +0000 | [diff] [blame] | 32 | br label %for.cond7.preheader |
| 33 | |
| 34 | for.cond7.preheader: ; preds = %for.cond7.preheader.lr.ph, %for.inc23 |
| 35 | %y.017 = phi i32 [ 0, %for.cond7.preheader.lr.ph ], [ %inc24, %for.inc23 ] |
| 36 | %i.116 = phi i32 [ 0, %for.cond7.preheader.lr.ph ], [ %i.2.lcssa, %for.inc23 ] |
| 37 | %n.015 = phi i32 [ undef, %for.cond7.preheader.lr.ph ], [ %inc25, %for.inc23 ] |
David Blaikie | a79ac14 | 2015-02-27 21:17:42 +0000 | [diff] [blame] | 38 | %1 = load i32, i32* @b, align 4, !tbaa !5 |
Andrew Trick | 0ae8c94f | 2013-07-13 06:20:06 +0000 | [diff] [blame] | 39 | %tobool11 = icmp eq i32 %1, 0 |
| 40 | br i1 %tobool11, label %for.inc23, label %for.body8.lr.ph |
| 41 | |
| 42 | for.body8.lr.ph: ; preds = %for.cond7.preheader |
| 43 | %add9 = add i32 %n.015, 1 |
| 44 | br label %for.body8 |
| 45 | |
| 46 | for.body8: ; preds = %for.body8.lr.ph, %for.inc19 |
| 47 | %indvars.iv19 = phi i64 [ 0, %for.body8.lr.ph ], [ %indvars.iv.next20, %for.inc19 ] |
| 48 | %i.213 = phi i32 [ %i.116, %for.body8.lr.ph ], [ 0, %for.inc19 ] |
| 49 | %2 = trunc i64 %indvars.iv19 to i32 |
| 50 | %add10 = add i32 %add9, %2 |
Manman Ren | adf4cc1 | 2013-09-30 18:17:55 +0000 | [diff] [blame] | 51 | store i32 %add10, i32* @f, align 4, !tbaa !5 |
Andrew Trick | 0ae8c94f | 2013-07-13 06:20:06 +0000 | [diff] [blame] | 52 | %idx.ext = sext i32 %add10 to i64 |
David Blaikie | 79e6c74 | 2015-02-27 19:29:02 +0000 | [diff] [blame] | 53 | %add.ptr = getelementptr inbounds i32, i32* @a, i64 %idx.ext |
Andrew Trick | 0ae8c94f | 2013-07-13 06:20:06 +0000 | [diff] [blame] | 54 | %tobool129 = icmp eq i32 %i.213, 0 |
| 55 | br i1 %tobool129, label %for.inc19, label %for.body13.lr.ph |
| 56 | |
| 57 | for.body13.lr.ph: ; preds = %for.body8 |
| 58 | %3 = sext i32 %i.213 to i64 |
| 59 | br label %for.body13 |
| 60 | |
| 61 | for.body13: ; preds = %for.body13.lr.ph, %for.body13 |
| 62 | %indvars.iv = phi i64 [ %3, %for.body13.lr.ph ], [ %indvars.iv.next, %for.body13 ] |
| 63 | %add.ptr.sum = add i64 %idx.ext, %indvars.iv |
David Blaikie | 79e6c74 | 2015-02-27 19:29:02 +0000 | [diff] [blame] | 64 | %arrayidx = getelementptr inbounds i32, i32* @a, i64 %add.ptr.sum |
David Blaikie | a79ac14 | 2015-02-27 21:17:42 +0000 | [diff] [blame] | 65 | %4 = load i32, i32* %arrayidx, align 4, !tbaa !5 |
David Blaikie | 79e6c74 | 2015-02-27 19:29:02 +0000 | [diff] [blame] | 66 | %arrayidx15 = getelementptr inbounds i32, i32* %0, i64 %indvars.iv |
Manman Ren | adf4cc1 | 2013-09-30 18:17:55 +0000 | [diff] [blame] | 67 | store i32 %4, i32* %arrayidx15, align 4, !tbaa !5 |
Andrew Trick | 0ae8c94f | 2013-07-13 06:20:06 +0000 | [diff] [blame] | 68 | %indvars.iv.next = add i64 %indvars.iv, 1 |
| 69 | %5 = trunc i64 %indvars.iv.next to i32 |
| 70 | %tobool12 = icmp eq i32 %5, 0 |
| 71 | br i1 %tobool12, label %for.cond11.for.inc19_crit_edge, label %for.body13 |
| 72 | |
| 73 | for.cond11.for.inc19_crit_edge: ; preds = %for.body13 |
| 74 | br label %for.inc19 |
| 75 | |
| 76 | for.inc19: ; preds = %for.cond11.for.inc19_crit_edge, %for.body8 |
David Blaikie | a79ac14 | 2015-02-27 21:17:42 +0000 | [diff] [blame] | 77 | %6 = load i32, i32* @c, align 4, !tbaa !5 |
Andrew Trick | 0ae8c94f | 2013-07-13 06:20:06 +0000 | [diff] [blame] | 78 | %inc20 = add nsw i32 %6, 1 |
Manman Ren | adf4cc1 | 2013-09-30 18:17:55 +0000 | [diff] [blame] | 79 | store i32 %inc20, i32* @c, align 4, !tbaa !5 |
Andrew Trick | 0ae8c94f | 2013-07-13 06:20:06 +0000 | [diff] [blame] | 80 | %indvars.iv.next20 = add i64 %indvars.iv19, 1 |
David Blaikie | a79ac14 | 2015-02-27 21:17:42 +0000 | [diff] [blame] | 81 | %7 = load i32, i32* @b, align 4, !tbaa !5 |
Andrew Trick | 0ae8c94f | 2013-07-13 06:20:06 +0000 | [diff] [blame] | 82 | %tobool = icmp eq i32 %7, 0 |
| 83 | br i1 %tobool, label %for.cond7.for.inc23_crit_edge, label %for.body8 |
| 84 | |
| 85 | for.cond7.for.inc23_crit_edge: ; preds = %for.inc19 |
| 86 | %add.ptr.lcssa = phi i32* [ %add.ptr, %for.inc19 ] |
Manman Ren | adf4cc1 | 2013-09-30 18:17:55 +0000 | [diff] [blame] | 87 | store i32* %add.ptr.lcssa, i32** @d, align 8, !tbaa !4 |
Andrew Trick | 0ae8c94f | 2013-07-13 06:20:06 +0000 | [diff] [blame] | 88 | br label %for.inc23 |
| 89 | |
| 90 | for.inc23: ; preds = %for.cond7.for.inc23_crit_edge, %for.cond7.preheader |
| 91 | %i.2.lcssa = phi i32 [ 0, %for.cond7.for.inc23_crit_edge ], [ %i.116, %for.cond7.preheader ] |
| 92 | %inc24 = add nsw i32 %y.017, 1 |
| 93 | %inc25 = add nsw i32 %n.015, 1 |
| 94 | %exitcond = icmp ne i32 %inc24, %call.lcssa |
| 95 | br i1 %exitcond, label %for.cond7.preheader, label %for.cond4.for.end26_crit_edge |
| 96 | |
| 97 | for.cond4.for.end26_crit_edge: ; preds = %for.inc23 |
| 98 | br label %for.end26 |
| 99 | |
| 100 | for.end26: ; preds = %for.cond4.for.end26_crit_edge, %for.cond4.preheader |
| 101 | ret void |
| 102 | } |
| 103 | declare i32 @fn2(double) #1 |
| 104 | |
| 105 | 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" } |
| 106 | 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" } |
| 107 | |
Duncan P. N. Exon Smith | be7ea19 | 2014-12-15 19:07:53 +0000 | [diff] [blame] | 108 | !0 = !{!"int", !1} |
| 109 | !1 = !{!"omnipotent char", !2} |
| 110 | !2 = !{!"Simple C/C++ TBAA"} |
| 111 | !3 = !{!"double", !1} |
| 112 | !4 = !{!0, !0, i64 0} |
| 113 | !5 = !{!3, !3, i64 0} |