1; Legacy pass manager 2; RUN: opt < %s -transform-warning -disable-output -pass-remarks-missed=transform-warning -pass-remarks-analysis=transform-warning 2>&1 | FileCheck %s 3; RUN: opt < %s -transform-warning -disable-output -pass-remarks-output=%t.yaml 4; RUN: cat %t.yaml | FileCheck -check-prefix=YAML %s 5 6; New pass manager 7; RUN: opt < %s -passes=transform-warning -disable-output -pass-remarks-missed=transform-warning -pass-remarks-analysis=transform-warning 2>&1 | FileCheck %s 8; RUN: opt < %s -passes=transform-warning -disable-output -pass-remarks-output=%t.yaml 9; RUN: cat %t.yaml | FileCheck -check-prefix=YAML %s 10 11 12; C/C++ code for tests 13; void test(int *A, int Length) { 14; #pragma clang loop vectorize(enable) interleave(enable) 15; for (int i = 0; i < Length; i++) { 16; A[i] = i; 17; if (A[i] > Length) 18; break; 19; } 20; } 21; File, line, and column should match those specified in the metadata 22; 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 23 24; YAML: --- !Failure 25; YAML-NEXT: Pass: transform-warning 26; YAML-NEXT: Name: FailedRequestedVectorization 27; YAML-NEXT: DebugLoc: { File: source.cpp, Line: 19, Column: 5 } 28; YAML-NEXT: Function: _Z17test_array_boundsPiS_i 29; YAML-NEXT: Args: 30; 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' 31; YAML-NEXT: ... 32 33target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128" 34 35define void @_Z17test_array_boundsPiS_i(i32* nocapture %A, i32* nocapture readonly %B, i32 %Length) !dbg !8 { 36entry: 37 %cmp9 = icmp sgt i32 %Length, 0, !dbg !32 38 br i1 %cmp9, label %for.body.preheader, label %for.end, !dbg !32, !llvm.loop !34 39 40for.body.preheader: 41 br label %for.body, !dbg !35 42 43for.body: 44 %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %for.body.preheader ] 45 %arrayidx = getelementptr inbounds i32, i32* %B, i64 %indvars.iv, !dbg !35 46 %0 = load i32, i32* %arrayidx, align 4, !dbg !35, !tbaa !18 47 %idxprom1 = sext i32 %0 to i64, !dbg !35 48 %arrayidx2 = getelementptr inbounds i32, i32* %A, i64 %idxprom1, !dbg !35 49 %1 = load i32, i32* %arrayidx2, align 4, !dbg !35, !tbaa !18 50 %arrayidx4 = getelementptr inbounds i32, i32* %A, i64 %indvars.iv, !dbg !35 51 store i32 %1, i32* %arrayidx4, align 4, !dbg !35, !tbaa !18 52 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1, !dbg !32 53 %lftr.wideiv = trunc i64 %indvars.iv.next to i32, !dbg !32 54 %exitcond = icmp eq i32 %lftr.wideiv, %Length, !dbg !32 55 br i1 %exitcond, label %for.end.loopexit, label %for.body, !dbg !32, !llvm.loop !34 56 57for.end.loopexit: 58 br label %for.end 59 60for.end: 61 ret void, !dbg !36 62} 63 64!llvm.dbg.cu = !{!0} 65!llvm.module.flags = !{!9, !10} 66!llvm.ident = !{!11} 67 68!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) 69!1 = !DIFile(filename: "source.cpp", directory: ".") 70!2 = !{} 71!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) 72!5 = !DIFile(filename: "source.cpp", directory: ".") 73!6 = !DISubroutineType(types: !2) 74!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) 75!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) 76!9 = !{i32 2, !"Dwarf Version", i32 2} 77!10 = !{i32 2, !"Debug Info Version", i32 3} 78!11 = !{!"clang version 3.5.0"} 79!12 = !DILocation(line: 3, column: 8, scope: !13) 80!13 = distinct !DILexicalBlock(line: 3, column: 3, file: !1, scope: !4) 81!14 = !{!14, !15, !15} 82!15 = !{!"llvm.loop.vectorize.enable", i1 true} 83!16 = !DILocation(line: 4, column: 5, scope: !17) 84!17 = distinct !DILexicalBlock(line: 3, column: 36, file: !1, scope: !13) 85!18 = !{!19, !19, i64 0} 86!19 = !{!"int", !20, i64 0} 87!20 = !{!"omnipotent char", !21, i64 0} 88!21 = !{!"Simple C/C++ TBAA"} 89!22 = !DILocation(line: 5, column: 9, scope: !23) 90!23 = distinct !DILexicalBlock(line: 5, column: 9, file: !1, scope: !17) 91!24 = !DILocation(line: 8, column: 1, scope: !4) 92!25 = !DILocation(line: 12, column: 8, scope: !26) 93!26 = distinct !DILexicalBlock(line: 12, column: 3, file: !1, scope: !7) 94!27 = !{!27, !28, !29} 95!28 = !{!"llvm.loop.interleave.count", i32 1} 96!29 = !{!"llvm.loop.vectorize.width", i32 1} 97!30 = !DILocation(line: 13, column: 5, scope: !26) 98!31 = !DILocation(line: 14, column: 1, scope: !7) 99!32 = !DILocation(line: 18, column: 8, scope: !33) 100!33 = distinct !DILexicalBlock(line: 18, column: 3, file: !1, scope: !8) 101!34 = !{!34, !15} 102!35 = !DILocation(line: 19, column: 5, scope: !33) 103!36 = !DILocation(line: 20, column: 1, scope: !8) 104!37 = distinct !DILexicalBlock(line: 24, column: 3, file: !1, scope: !46) 105!38 = !DILocation(line: 27, column: 3, scope: !37) 106!39 = !DILocation(line: 31, column: 3, scope: !37) 107!40 = !DILocation(line: 28, column: 9, scope: !37) 108!41 = !DILocation(line: 29, column: 11, scope: !37) 109!42 = !DILocation(line: 29, column: 7, scope: !37) 110!43 = !DILocation(line: 27, column: 32, scope: !37) 111!44 = !DILocation(line: 27, column: 30, scope: !37) 112!45 = !DILocation(line: 27, column: 21, scope: !37) 113!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) 114