1 ; RUN: opt < %s -passes=transform-warning -disable-output -pass-remarks-missed=transform-warning -pass-remarks-analysis=transform-warning 2>&1 | FileCheck %s
2 ; RUN: opt < %s -passes=transform-warning -disable-output -pass-remarks-output=%t.yaml
3 ; RUN: cat %t.yaml | FileCheck -check-prefix=YAML %s
7 ; void test(int *A, int Length) {
8 ; #pragma clang loop vectorize(enable) interleave(enable)
9 ; for (int i = 0; i < Length; i++) {
15 ; File, line, and column should match those specified in the metadata
16 ; CHECK: warning: source.cpp:19:5: loop not vectorized: the optimizer was unable to perform the requested transformation; the transformation might be disabled or specified as part of an unsupported transformation ordering
19 ; YAML-NEXT: Pass: transform-warning
20 ; YAML-NEXT: Name: FailedRequestedVectorization
21 ; YAML-NEXT: DebugLoc: { File: source.cpp, Line: 19, Column: 5 }
22 ; YAML-NEXT: Function: _Z17test_array_boundsPiS_i
24 ; YAML-NEXT: - String: 'loop not vectorized: the optimizer was unable to perform the requested transformation; the transformation might be disabled or specified as part of an unsupported transformation ordering'
27 target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
29 define void @_Z17test_array_boundsPiS_i(ptr nocapture %A, ptr nocapture readonly %B, i32 %Length) !dbg !8 {
31 %cmp9 = icmp sgt i32 %Length, 0, !dbg !32
32 br i1 %cmp9, label %for.body.preheader, label %for.end, !dbg !32, !llvm.loop !34
35 br label %for.body, !dbg !35
38 %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %for.body.preheader ]
39 %arrayidx = getelementptr inbounds i32, ptr %B, i64 %indvars.iv, !dbg !35
40 %0 = load i32, ptr %arrayidx, align 4, !dbg !35, !tbaa !18
41 %idxprom1 = sext i32 %0 to i64, !dbg !35
42 %arrayidx2 = getelementptr inbounds i32, ptr %A, i64 %idxprom1, !dbg !35
43 %1 = load i32, ptr %arrayidx2, align 4, !dbg !35, !tbaa !18
44 %arrayidx4 = getelementptr inbounds i32, ptr %A, i64 %indvars.iv, !dbg !35
45 store i32 %1, ptr %arrayidx4, align 4, !dbg !35, !tbaa !18
46 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1, !dbg !32
47 %lftr.wideiv = trunc i64 %indvars.iv.next to i32, !dbg !32
48 %exitcond = icmp eq i32 %lftr.wideiv, %Length, !dbg !32
49 br i1 %exitcond, label %for.end.loopexit, label %for.body, !dbg !32, !llvm.loop !34
59 !llvm.module.flags = !{!9, !10}
62 !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)
63 !1 = !DIFile(filename: "source.cpp", directory: ".")
65 !4 = distinct !DISubprogram(name: "test", line: 1, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: true, unit: !0, scopeLine: 1, file: !1, scope: !5, type: !6, retainedNodes: !2)
66 !5 = !DIFile(filename: "source.cpp", directory: ".")
67 !6 = !DISubroutineType(types: !2)
68 !7 = distinct !DISubprogram(name: "test_disabled", line: 10, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: true, unit: !0, scopeLine: 10, file: !1, scope: !5, type: !6, retainedNodes: !2)
69 !8 = distinct !DISubprogram(name: "test_array_bounds", line: 16, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: true, unit: !0, scopeLine: 16, file: !1, scope: !5, type: !6, retainedNodes: !2)
70 !9 = !{i32 2, !"Dwarf Version", i32 2}
71 !10 = !{i32 2, !"Debug Info Version", i32 3}
72 !11 = !{!"clang version 3.5.0"}
73 !12 = !DILocation(line: 3, column: 8, scope: !13)
74 !13 = distinct !DILexicalBlock(line: 3, column: 3, file: !1, scope: !4)
75 !14 = !{!14, !15, !15}
76 !15 = !{!"llvm.loop.vectorize.enable", i1 true}
77 !16 = !DILocation(line: 4, column: 5, scope: !17)
78 !17 = distinct !DILexicalBlock(line: 3, column: 36, file: !1, scope: !13)
79 !18 = !{!19, !19, i64 0}
80 !19 = !{!"int", !20, i64 0}
81 !20 = !{!"omnipotent char", !21, i64 0}
82 !21 = !{!"Simple C/C++ TBAA"}
83 !22 = !DILocation(line: 5, column: 9, scope: !23)
84 !23 = distinct !DILexicalBlock(line: 5, column: 9, file: !1, scope: !17)
85 !24 = !DILocation(line: 8, column: 1, scope: !4)
86 !25 = !DILocation(line: 12, column: 8, scope: !26)
87 !26 = distinct !DILexicalBlock(line: 12, column: 3, file: !1, scope: !7)
88 !27 = !{!27, !28, !29}
89 !28 = !{!"llvm.loop.interleave.count", i32 1}
90 !29 = !{!"llvm.loop.vectorize.width", i32 1}
91 !30 = !DILocation(line: 13, column: 5, scope: !26)
92 !31 = !DILocation(line: 14, column: 1, scope: !7)
93 !32 = !DILocation(line: 18, column: 8, scope: !33)
94 !33 = distinct !DILexicalBlock(line: 18, column: 3, file: !1, scope: !8)
96 !35 = !DILocation(line: 19, column: 5, scope: !33)
97 !36 = !DILocation(line: 20, column: 1, scope: !8)
98 !37 = distinct !DILexicalBlock(line: 24, column: 3, file: !1, scope: !46)
99 !38 = !DILocation(line: 27, column: 3, scope: !37)
100 !39 = !DILocation(line: 31, column: 3, scope: !37)
101 !40 = !DILocation(line: 28, column: 9, scope: !37)
102 !41 = !DILocation(line: 29, column: 11, scope: !37)
103 !42 = !DILocation(line: 29, column: 7, scope: !37)
104 !43 = !DILocation(line: 27, column: 32, scope: !37)
105 !44 = !DILocation(line: 27, column: 30, scope: !37)
106 !45 = !DILocation(line: 27, column: 21, scope: !37)
107 !46 = distinct !DISubprogram(name: "test_multiple_failures", line: 26, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: true, unit: !0, scopeLine: 26, file: !1, scope: !5, type: !6, retainedNodes: !2)