1*2e14900dSBjorn Pettersson; RUN: opt < %s -passes=loop-vectorize -force-vector-width=4 -S -pass-remarks-missed='loop-vectorize' 2>&1 | FileCheck %s
2cee313d2SEric Christopher
3cee313d2SEric Christopher; C/C++ code for control flow test
4cee313d2SEric Christopher; int test(int *A, int Length) {
5cee313d2SEric Christopher;   for (int i = 0; i < Length; i++) {
6cee313d2SEric Christopher;     if (A[i] > 10.0) goto end;
7cee313d2SEric Christopher;     A[i] = 0;
8cee313d2SEric Christopher;   }
9cee313d2SEric Christopher; end:
10cee313d2SEric Christopher;   return 0;
11cee313d2SEric Christopher; }
12cee313d2SEric Christopher
134b33b238SPhilip Reames; CHECK: remark: source.cpp:5:9: loop not vectorized: could not determine number of loop iterations
14cee313d2SEric Christopher; CHECK: remark: source.cpp:5:9: loop not vectorized
15cee313d2SEric Christopher
16cee313d2SEric Christopher; CHECK: _Z4testPii
17cee313d2SEric Christopher; CHECK-NOT: x i32>
18cee313d2SEric Christopher; CHECK: ret
19cee313d2SEric Christopher
20cee313d2SEric Christophertarget datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
21cee313d2SEric Christopher
22cee313d2SEric Christopher; Function Attrs: nounwind optsize ssp uwtable
23cee313d2SEric Christopherdefine i32 @_Z4testPii(i32* nocapture %A, i32 %Length) #0 !dbg !4 {
24cee313d2SEric Christopherentry:
25cee313d2SEric Christopher  %cmp8 = icmp sgt i32 %Length, 0, !dbg !10
26cee313d2SEric Christopher  br i1 %cmp8, label %for.body.preheader, label %end, !dbg !10
27cee313d2SEric Christopher
28cee313d2SEric Christopherfor.body.preheader:                               ; preds = %entry
29cee313d2SEric Christopher  br label %for.body, !dbg !12
30cee313d2SEric Christopher
31cee313d2SEric Christopherfor.body:                                         ; preds = %for.body.preheader, %if.else
32cee313d2SEric Christopher  %indvars.iv = phi i64 [ %indvars.iv.next, %if.else ], [ 0, %for.body.preheader ]
33cee313d2SEric Christopher  %arrayidx = getelementptr inbounds i32, i32* %A, i64 %indvars.iv, !dbg !12
34cee313d2SEric Christopher  %0 = load i32, i32* %arrayidx, align 4, !dbg !12, !tbaa !15
35cee313d2SEric Christopher  %cmp1 = icmp sgt i32 %0, 10, !dbg !12
36cee313d2SEric Christopher  br i1 %cmp1, label %end.loopexit, label %if.else, !dbg !12
37cee313d2SEric Christopher
38cee313d2SEric Christopherif.else:                                          ; preds = %for.body
39cee313d2SEric Christopher  store i32 0, i32* %arrayidx, align 4, !dbg !19, !tbaa !15
40cee313d2SEric Christopher  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1, !dbg !10
41cee313d2SEric Christopher  %1 = trunc i64 %indvars.iv.next to i32, !dbg !10
42cee313d2SEric Christopher  %cmp = icmp slt i32 %1, %Length, !dbg !10
43cee313d2SEric Christopher  br i1 %cmp, label %for.body, label %end.loopexit, !dbg !10
44cee313d2SEric Christopher
45cee313d2SEric Christopherend.loopexit:                                     ; preds = %if.else, %for.body
46cee313d2SEric Christopher  br label %end
47cee313d2SEric Christopher
48cee313d2SEric Christopherend:                                              ; preds = %end.loopexit, %entry
49cee313d2SEric Christopher  ret i32 0, !dbg !20
50cee313d2SEric Christopher}
51cee313d2SEric Christopher
52cee313d2SEric Christopherattributes #0 = { nounwind }
53cee313d2SEric Christopher
54cee313d2SEric Christopher!llvm.dbg.cu = !{!0}
55cee313d2SEric Christopher!llvm.module.flags = !{!7, !8}
56cee313d2SEric Christopher!llvm.ident = !{!9}
57cee313d2SEric Christopher
58cee313d2SEric Christopher!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, producer: "clang version 3.5.0", isOptimized: true, runtimeVersion: 6, emissionKind: LineTablesOnly, file: !1, enums: !2, retainedTypes: !2, globals: !2, imports: !2)
59cee313d2SEric Christopher!1 = !DIFile(filename: "source.cpp", directory: ".")
60cee313d2SEric Christopher!2 = !{}
61cee313d2SEric Christopher!4 = distinct !DISubprogram(name: "test", line: 1, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: true, unit: !0, scopeLine: 2, file: !1, scope: !5, type: !6, retainedNodes: !2)
62cee313d2SEric Christopher!5 = !DIFile(filename: "source.cpp", directory: ".")
63cee313d2SEric Christopher!6 = !DISubroutineType(types: !2)
64cee313d2SEric Christopher!7 = !{i32 2, !"Dwarf Version", i32 2}
65cee313d2SEric Christopher!8 = !{i32 2, !"Debug Info Version", i32 3}
66cee313d2SEric Christopher!9 = !{!"clang version 3.5.0"}
67cee313d2SEric Christopher!10 = !DILocation(line: 3, column: 8, scope: !11)
68cee313d2SEric Christopher!11 = distinct !DILexicalBlock(line: 3, column: 3, file: !1, scope: !4)
69cee313d2SEric Christopher!12 = !DILocation(line: 5, column: 9, scope: !13)
70cee313d2SEric Christopher!13 = distinct !DILexicalBlock(line: 5, column: 9, file: !1, scope: !14)
71cee313d2SEric Christopher!14 = distinct !DILexicalBlock(line: 4, column: 3, file: !1, scope: !11)
72cee313d2SEric Christopher!15 = !{!16, !16, i64 0}
73cee313d2SEric Christopher!16 = !{!"int", !17, i64 0}
74cee313d2SEric Christopher!17 = !{!"omnipotent char", !18, i64 0}
75cee313d2SEric Christopher!18 = !{!"Simple C/C++ TBAA"}
76cee313d2SEric Christopher!19 = !DILocation(line: 8, column: 7, scope: !13)
77cee313d2SEric Christopher!20 = !DILocation(line: 12, column: 3, scope: !4)
78