1 ; RUN: opt < %s -loop-vectorize -mtriple=x86_64-unknown-linux -S -pass-remarks='loop-vectorize' 2>&1 | FileCheck -check-prefix=VECTORIZED %s 2 ; RUN: opt < %s -loop-vectorize -force-vector-width=1 -force-vector-unroll=4 -mtriple=x86_64-unknown-linux -S -pass-remarks='loop-vectorize' 2>&1 | FileCheck -check-prefix=UNROLLED %s 3 ; RUN: opt < %s -loop-vectorize -force-vector-width=1 -force-vector-unroll=1 -mtriple=x86_64-unknown-linux -S -pass-remarks-analysis='loop-vectorize' 2>&1 | FileCheck -check-prefix=NONE %s 4 5 ; This code has all the !dbg annotations needed to track source line information, 6 ; but is missing the llvm.dbg.cu annotation. This prevents code generation from 7 ; emitting debug info in the final output. 8 ; RUN: llc -mtriple x86_64-pc-linux-gnu %s -o - | FileCheck -check-prefix=DEBUG-OUTPUT %s 9 ; DEBUG-OUTPUT-NOT: .loc 10 ; DEBUG-OUTPUT-NOT: {{.*}}.debug_info 11 12 ; VECTORIZED: remark: vectorization-remarks.c:17:8: vectorized loop (vectorization factor: 4, unrolling interleave factor: 1) 13 ; UNROLLED: remark: vectorization-remarks.c:17:8: unrolled with interleaving factor 4 (vectorization not beneficial) 14 ; NONE: remark: vectorization-remarks.c:17:8: loop not vectorized: vector width and interleave count are explicitly set to 1 15 16 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" 17 18 define i32 @foo(i32 %n) #0 { 19 entry: 20 %diff = alloca i32, align 4 21 %cb = alloca [16 x i8], align 16 22 %cc = alloca [16 x i8], align 16 23 store i32 0, i32* %diff, align 4, !dbg !10, !tbaa !11 24 br label %for.body, !dbg !15 25 26 for.body: ; preds = %for.body, %entry 27 %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ] 28 %add8 = phi i32 [ 0, %entry ], [ %add, %for.body ], !dbg !19 29 %arrayidx = getelementptr inbounds [16 x i8]* %cb, i64 0, i64 %indvars.iv, !dbg !19 30 %0 = load i8* %arrayidx, align 1, !dbg !19, !tbaa !21 31 %conv = sext i8 %0 to i32, !dbg !19 32 %arrayidx2 = getelementptr inbounds [16 x i8]* %cc, i64 0, i64 %indvars.iv, !dbg !19 33 %1 = load i8* %arrayidx2, align 1, !dbg !19, !tbaa !21 34 %conv3 = sext i8 %1 to i32, !dbg !19 35 %sub = sub i32 %conv, %conv3, !dbg !19 36 %add = add nsw i32 %sub, %add8, !dbg !19 37 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1, !dbg !15 38 %exitcond = icmp eq i64 %indvars.iv.next, 16, !dbg !15 39 br i1 %exitcond, label %for.end, label %for.body, !dbg !15 40 41 for.end: ; preds = %for.body 42 store i32 %add, i32* %diff, align 4, !dbg !19, !tbaa !11 43 call void @ibar(i32* %diff) #2, !dbg !22 44 ret i32 0, !dbg !23 45 } 46 47 declare void @ibar(i32*) #1 48 49 !llvm.module.flags = !{!7, !8} 50 !llvm.ident = !{!9} 51 52 !1 = metadata !{metadata !"vectorization-remarks.c", metadata !"."} 53 !2 = metadata !{} 54 !3 = metadata !{metadata !4} 55 !4 = metadata !{i32 786478, metadata !1, metadata !5, metadata !"foo", metadata !"foo", metadata !"", i32 5, metadata !6, i1 false, i1 true, i32 0, i32 0, null, i32 256, i1 true, i32 (i32)* @foo, null, null, metadata !2, i32 6} ; [ DW_TAG_subprogram ] [line 5] [def] [scope 6] [foo] 56 !5 = metadata !{i32 786473, metadata !1} ; [ DW_TAG_file_type ] [./vectorization-remarks.c] 57 !6 = metadata !{i32 786453, i32 0, null, metadata !"", i32 0, i64 0, i64 0, i64 0, i32 0, null, metadata !2, i32 0, null, null, null} ; [ DW_TAG_subroutine_type ] [line 0, size 0, align 0, offset 0] [from ] 58 !7 = metadata !{i32 2, metadata !"Dwarf Version", i32 4} 59 !8 = metadata !{i32 1, metadata !"Debug Info Version", i32 1} 60 !9 = metadata !{metadata !"clang version 3.5.0 "} 61 !10 = metadata !{i32 8, i32 3, metadata !4, null} ; [ DW_TAG_imported_declaration ] 62 !11 = metadata !{metadata !12, metadata !12, i64 0} 63 !12 = metadata !{metadata !"int", metadata !13, i64 0} 64 !13 = metadata !{metadata !"omnipotent char", metadata !14, i64 0} 65 !14 = metadata !{metadata !"Simple C/C++ TBAA"} 66 !15 = metadata !{i32 17, i32 8, metadata !16, null} 67 !16 = metadata !{i32 786443, metadata !1, metadata !17, i32 17, i32 8, i32 2, i32 3} ; [ DW_TAG_lexical_block ] [./vectorization-remarks.c] 68 !17 = metadata !{i32 786443, metadata !1, metadata !18, i32 17, i32 8, i32 1, i32 2} ; [ DW_TAG_lexical_block ] [./vectorization-remarks.c] 69 !18 = metadata !{i32 786443, metadata !1, metadata !4, i32 17, i32 3, i32 0, i32 0} ; [ DW_TAG_lexical_block ] [./vectorization-remarks.c] 70 !19 = metadata !{i32 18, i32 5, metadata !20, null} 71 !20 = metadata !{i32 786443, metadata !1, metadata !18, i32 17, i32 27, i32 0, i32 1} ; [ DW_TAG_lexical_block ] [./vectorization-remarks.c] 72 !21 = metadata !{metadata !13, metadata !13, i64 0} 73 !22 = metadata !{i32 20, i32 3, metadata !4, null} 74 !23 = metadata !{i32 21, i32 3, metadata !4, null} 75