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
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)
7 target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
8 target triple = "x86_64-apple-macosx10.10.0"
10 ; Function Attrs: nounwind readonly ssp uwtable
11 define double @cond_sum(i32* nocapture readonly %v, i32 %n) #0 !dbg !4 {
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
16 for.body.preheader: ; preds = %entry
17 br label %for.body, !dbg !9
19 for.cond.cleanup.loopexit: ; preds = %for.body
20 %add.lcssa = phi double [ %add, %for.body ]
21 br label %for.cond.cleanup, !dbg !10
23 for.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
27 for.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
41 ; Function Attrs: nounwind readonly ssp uwtable
42 define double @cond_sum_loop_hint(i32* nocapture readonly %v, i32 %n) #0 !dbg !20 {
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
47 for.body.preheader: ; preds = %entry
48 br label %for.body, !dbg !22
50 for.cond.cleanup.loopexit: ; preds = %for.body
51 %add.lcssa = phi double [ %add, %for.body ]
52 br label %for.cond.cleanup, !dbg !23
54 for.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
58 for.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
72 attributes #0 = { nounwind }
75 !llvm.module.flags = !{!0, !1}
78 !0 = !{i32 2, !"Debug Info Version", i32 3}
79 !1 = !{i32 1, !"PIC Level", i32 2}
80 !2 = !{!"clang version 3.7.0"}
81 !3 = !DILocation(line: 5, column: 20, scope: !4)
82 !4 = distinct !DISubprogram(name: "cond_sum", scope: !5, file: !5, line: 1, type: !6, isLocal: false, isDefinition: true, scopeLine: 1, flags: DIFlagPrototyped, isOptimized: true, unit: !28, retainedNodes: !7)
83 !5 = !DIFile(filename: "no_fpmath.c", directory: "")
84 !6 = !DISubroutineType(types: !7)
86 !8 = !DILocation(line: 5, column: 3, scope: !4)
87 !9 = !DILocation(line: 6, column: 14, scope: !4)
88 !10 = !DILocation(line: 9, column: 3, scope: !4)
89 !11 = !{!12, !12, i64 0}
90 !12 = !{!"int", !13, i64 0}
91 !13 = !{!"omnipotent char", !14, i64 0}
92 !14 = !{!"Simple C/C++ TBAA"}
93 !15 = !DILocation(line: 6, column: 19, scope: !4)
94 !16 = !DILocation(line: 6, column: 11, scope: !4)
95 !17 = distinct !{!17, !18}
96 !18 = !{!"llvm.loop.unroll.disable"}
97 !19 = !DILocation(line: 16, column: 20, scope: !20)
98 !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, unit: !28, retainedNodes: !7)
99 !21 = !DILocation(line: 16, column: 3, scope: !20)
100 !22 = !DILocation(line: 17, column: 14, scope: !20)
101 !23 = !DILocation(line: 20, column: 3, scope: !20)
102 !24 = !DILocation(line: 17, column: 19, scope: !20)
103 !25 = !DILocation(line: 17, column: 11, scope: !20)
104 !26 = distinct !{!26, !27, !18}
105 !27 = !{!"llvm.loop.vectorize.enable", i1 true}
106 !28 = distinct !DICompileUnit(language: DW_LANG_C99, producer: "clang",
108 isOptimized: true, flags: "-O2",
109 splitDebugFilename: "abc.debug", emissionKind: 2)