• Home
  • History
  • Annotate
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: opt < %s -loop-vectorize -mtriple=x86_64-unknown-linux -S -pass-remarks='loop-vectorize' -pass-remarks-missed='loop-vectorize' -pass-remarks-analysis='loop-vectorize' 2>&1 | FileCheck %s
2
3; CHECK: remark: no_fpmath.c:6:11: loop not vectorized: cannot prove it is safe to reorder floating-point operations
4; CHECK: remark: no_fpmath.c:6:14: loop not vectorized:
5; CHECK: remark: no_fpmath.c:17:14: vectorized loop (vectorization width: 2, interleaved count: 2)
6
7target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
8target triple = "x86_64-apple-macosx10.10.0"
9
10; Function Attrs: nounwind readonly ssp uwtable
11define double @cond_sum(i32* nocapture readonly %v, i32 %n) #0 !dbg !4 {
12entry:
13  %cmp.7 = icmp sgt i32 %n, 0, !dbg !3
14  br i1 %cmp.7, label %for.body.preheader, label %for.cond.cleanup, !dbg !8
15
16for.body.preheader:                               ; preds = %entry
17  br label %for.body, !dbg !9
18
19for.cond.cleanup.loopexit:                        ; preds = %for.body
20  %add.lcssa = phi double [ %add, %for.body ]
21  br label %for.cond.cleanup, !dbg !10
22
23for.cond.cleanup:                                 ; preds = %for.cond.cleanup.loopexit, %entry
24  %a.0.lcssa = phi double [ 0.000000e+00, %entry ], [ %add.lcssa, %for.cond.cleanup.loopexit ]
25  ret double %a.0.lcssa, !dbg !10
26
27for.body:                                         ; preds = %for.body.preheader, %for.body
28  %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %for.body.preheader ]
29  %a.08 = phi double [ %add, %for.body ], [ 0.000000e+00, %for.body.preheader ]
30  %arrayidx = getelementptr inbounds i32, i32* %v, i64 %indvars.iv, !dbg !9
31  %0 = load i32, i32* %arrayidx, align 4, !dbg !9, !tbaa !11
32  %cmp1 = icmp eq i32 %0, 0, !dbg !15
33  %cond = select i1 %cmp1, double 3.400000e+00, double 1.150000e+00, !dbg !9
34  %add = fadd double %a.08, %cond, !dbg !16
35  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1, !dbg !8
36  %lftr.wideiv = trunc i64 %indvars.iv.next to i32, !dbg !8
37  %exitcond = icmp eq i32 %lftr.wideiv, %n, !dbg !8
38  br i1 %exitcond, label %for.cond.cleanup.loopexit, label %for.body, !dbg !8, !llvm.loop !17
39}
40
41; Function Attrs: nounwind readonly ssp uwtable
42define double @cond_sum_loop_hint(i32* nocapture readonly %v, i32 %n) #0 !dbg !20 {
43entry:
44  %cmp.7 = icmp sgt i32 %n, 0, !dbg !19
45  br i1 %cmp.7, label %for.body.preheader, label %for.cond.cleanup, !dbg !21
46
47for.body.preheader:                               ; preds = %entry
48  br label %for.body, !dbg !22
49
50for.cond.cleanup.loopexit:                        ; preds = %for.body
51  %add.lcssa = phi double [ %add, %for.body ]
52  br label %for.cond.cleanup, !dbg !23
53
54for.cond.cleanup:                                 ; preds = %for.cond.cleanup.loopexit, %entry
55  %a.0.lcssa = phi double [ 0.000000e+00, %entry ], [ %add.lcssa, %for.cond.cleanup.loopexit ]
56  ret double %a.0.lcssa, !dbg !23
57
58for.body:                                         ; preds = %for.body.preheader, %for.body
59  %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %for.body.preheader ]
60  %a.08 = phi double [ %add, %for.body ], [ 0.000000e+00, %for.body.preheader ]
61  %arrayidx = getelementptr inbounds i32, i32* %v, i64 %indvars.iv, !dbg !22
62  %0 = load i32, i32* %arrayidx, align 4, !dbg !22, !tbaa !11
63  %cmp1 = icmp eq i32 %0, 0, !dbg !24
64  %cond = select i1 %cmp1, double 3.400000e+00, double 1.150000e+00, !dbg !22
65  %add = fadd double %a.08, %cond, !dbg !25
66  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1, !dbg !21
67  %lftr.wideiv = trunc i64 %indvars.iv.next to i32, !dbg !21
68  %exitcond = icmp eq i32 %lftr.wideiv, %n, !dbg !21
69  br i1 %exitcond, label %for.cond.cleanup.loopexit, label %for.body, !dbg !21, !llvm.loop !26
70}
71
72attributes #0 = { nounwind }
73
74!llvm.module.flags = !{!0, !1}
75!llvm.ident = !{!2}
76
77!0 = !{i32 2, !"Debug Info Version", i32 3}
78!1 = !{i32 1, !"PIC Level", i32 2}
79!2 = !{!"clang version 3.7.0"}
80!3 = !DILocation(line: 5, column: 20, scope: !4)
81!4 = distinct !DISubprogram(name: "cond_sum", scope: !5, file: !5, line: 1, type: !6, isLocal: false, isDefinition: true, scopeLine: 1, flags: DIFlagPrototyped, isOptimized: true, variables: !7)
82!5 = !DIFile(filename: "no_fpmath.c", directory: "")
83!6 = !DISubroutineType(types: !7)
84!7 = !{}
85!8 = !DILocation(line: 5, column: 3, scope: !4)
86!9 = !DILocation(line: 6, column: 14, scope: !4)
87!10 = !DILocation(line: 9, column: 3, scope: !4)
88!11 = !{!12, !12, i64 0}
89!12 = !{!"int", !13, i64 0}
90!13 = !{!"omnipotent char", !14, i64 0}
91!14 = !{!"Simple C/C++ TBAA"}
92!15 = !DILocation(line: 6, column: 19, scope: !4)
93!16 = !DILocation(line: 6, column: 11, scope: !4)
94!17 = distinct !{!17, !18}
95!18 = !{!"llvm.loop.unroll.disable"}
96!19 = !DILocation(line: 16, column: 20, scope: !20)
97!20 = distinct !DISubprogram(name: "cond_sum_loop_hint", scope: !5, file: !5, line: 12, type: !6, isLocal: false, isDefinition: true, scopeLine: 12, flags: DIFlagPrototyped, isOptimized: true, variables: !7)
98!21 = !DILocation(line: 16, column: 3, scope: !20)
99!22 = !DILocation(line: 17, column: 14, scope: !20)
100!23 = !DILocation(line: 20, column: 3, scope: !20)
101!24 = !DILocation(line: 17, column: 19, scope: !20)
102!25 = !DILocation(line: 17, column: 11, scope: !20)
103!26 = distinct !{!26, !27, !18}
104!27 = !{!"llvm.loop.vectorize.enable", i1 true}
105