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