137ed9c199ca639565f6ce88105f9e39e898d82d0Stephen Hines; RUN: opt < %s -S -loop-vectorize -force-vector-interleave=1 -force-vector-width=4 -dce -instcombine | FileCheck %s
256ee544a3af2b019329f06422c00e8a3645b895cArnold Schwaighofer; Make sure we vectorize with debugging turned on.
356ee544a3af2b019329f06422c00e8a3645b895cArnold Schwaighofer
456ee544a3af2b019329f06422c00e8a3645b895cArnold Schwaighofertarget datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
556ee544a3af2b019329f06422c00e8a3645b895cArnold Schwaighofertarget triple = "x86_64-apple-macosx10.8.0"
656ee544a3af2b019329f06422c00e8a3645b895cArnold Schwaighofer
756ee544a3af2b019329f06422c00e8a3645b895cArnold Schwaighofer@A = global [1024 x i32] zeroinitializer, align 16
856ee544a3af2b019329f06422c00e8a3645b895cArnold Schwaighofer@B = global [1024 x i32] zeroinitializer, align 16
956ee544a3af2b019329f06422c00e8a3645b895cArnold Schwaighofer@C = global [1024 x i32] zeroinitializer, align 16
1056ee544a3af2b019329f06422c00e8a3645b895cArnold Schwaighofer
1139f4e8d9cce22b60a3417a5f17c847fa5b1daebfStephen Lin; CHECK-LABEL: @test(
12f3ef5332fa3f4d5ec72c178a2b19dac363a19383Pirama Arumuga Nainardefine i32 @test() #0 !dbg !3 {
1356ee544a3af2b019329f06422c00e8a3645b895cArnold Schwaighoferentry:
146948897e478cbd66626159776a8017b3c18579b9Pirama Arumuga Nainar  tail call void @llvm.dbg.value(metadata i32 0, i64 0, metadata !9, metadata !DIExpression()), !dbg !18
1556ee544a3af2b019329f06422c00e8a3645b895cArnold Schwaighofer  br label %for.body, !dbg !18
1656ee544a3af2b019329f06422c00e8a3645b895cArnold Schwaighofer
1756ee544a3af2b019329f06422c00e8a3645b895cArnold Schwaighoferfor.body:
1856ee544a3af2b019329f06422c00e8a3645b895cArnold Schwaighofer  ;CHECK: load <4 x i32>
1956ee544a3af2b019329f06422c00e8a3645b895cArnold Schwaighofer  %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ]
204c5e43da7792f75567b693105cc53e3f1992ad98Pirama Arumuga Nainar  %arrayidx = getelementptr inbounds [1024 x i32], [1024 x i32]* @B, i64 0, i64 %indvars.iv, !dbg !19
214c5e43da7792f75567b693105cc53e3f1992ad98Pirama Arumuga Nainar  %0 = load i32, i32* %arrayidx, align 4, !dbg !19
224c5e43da7792f75567b693105cc53e3f1992ad98Pirama Arumuga Nainar  %arrayidx2 = getelementptr inbounds [1024 x i32], [1024 x i32]* @C, i64 0, i64 %indvars.iv, !dbg !19
234c5e43da7792f75567b693105cc53e3f1992ad98Pirama Arumuga Nainar  %1 = load i32, i32* %arrayidx2, align 4, !dbg !19
2456ee544a3af2b019329f06422c00e8a3645b895cArnold Schwaighofer  %add = add nsw i32 %1, %0, !dbg !19
254c5e43da7792f75567b693105cc53e3f1992ad98Pirama Arumuga Nainar  %arrayidx4 = getelementptr inbounds [1024 x i32], [1024 x i32]* @A, i64 0, i64 %indvars.iv, !dbg !19
262dc50d306752c8672d1543feb88517705cdb25e7Manman Ren  store i32 %add, i32* %arrayidx4, align 4, !dbg !19
2756ee544a3af2b019329f06422c00e8a3645b895cArnold Schwaighofer  %indvars.iv.next = add i64 %indvars.iv, 1, !dbg !18
286948897e478cbd66626159776a8017b3c18579b9Pirama Arumuga Nainar  tail call void @llvm.dbg.value(metadata !{null}, i64 0, metadata !9, metadata !DIExpression()), !dbg !18
2956ee544a3af2b019329f06422c00e8a3645b895cArnold Schwaighofer  %lftr.wideiv = trunc i64 %indvars.iv.next to i32, !dbg !18
3056ee544a3af2b019329f06422c00e8a3645b895cArnold Schwaighofer  %exitcond = icmp ne i32 %lftr.wideiv, 1024, !dbg !18
3156ee544a3af2b019329f06422c00e8a3645b895cArnold Schwaighofer  br i1 %exitcond, label %for.body, label %for.end, !dbg !18
3256ee544a3af2b019329f06422c00e8a3645b895cArnold Schwaighofer
3356ee544a3af2b019329f06422c00e8a3645b895cArnold Schwaighoferfor.end:
3456ee544a3af2b019329f06422c00e8a3645b895cArnold Schwaighofer  ret i32 0, !dbg !24
3556ee544a3af2b019329f06422c00e8a3645b895cArnold Schwaighofer}
3656ee544a3af2b019329f06422c00e8a3645b895cArnold Schwaighofer
3737ed9c199ca639565f6ce88105f9e39e898d82d0Stephen Hinesdeclare void @llvm.dbg.declare(metadata, metadata, metadata) #1
3856ee544a3af2b019329f06422c00e8a3645b895cArnold Schwaighofer
3937ed9c199ca639565f6ce88105f9e39e898d82d0Stephen Hinesdeclare void @llvm.dbg.value(metadata, i64, metadata, metadata) #1
4056ee544a3af2b019329f06422c00e8a3645b895cArnold Schwaighofer
4161fc8d670f1e991804c2ab753e567981e60962cbBill Wendlingattributes #0 = { nounwind ssp uwtable "fp-contract-model"="standard" "no-frame-pointer-elim" "no-frame-pointer-elim-non-leaf" "relocation-model"="pic" "ssp-buffers-size"="8" }
4256ee544a3af2b019329f06422c00e8a3645b895cArnold Schwaighoferattributes #1 = { nounwind readnone }
4356ee544a3af2b019329f06422c00e8a3645b895cArnold Schwaighofer
4456ee544a3af2b019329f06422c00e8a3645b895cArnold Schwaighofer!llvm.dbg.cu = !{!0}
4541245b4e2a2c71d764534b41bc38fea7c5cf6774Manman Ren!llvm.module.flags = !{!26}
4656ee544a3af2b019329f06422c00e8a3645b895cArnold Schwaighofer
47de2d8694e25a814696358e95141f4b1aa4d8847ePirama Arumuga Nainar!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, producer: "clang", isOptimized: true, emissionKind: FullDebug, file: !25, enums: !1, retainedTypes: !1, globals: !11)
480c7f116bb6950ef819323d855415b2f2b0aad987Pirama Arumuga Nainar!1 = !{}
49de2d8694e25a814696358e95141f4b1aa4d8847ePirama Arumuga Nainar!3 = distinct !DISubprogram(name: "test", linkageName: "test", line: 5, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: true, unit: !0, scopeLine: 5, file: !25, scope: !4, type: !5, variables: !8)
506948897e478cbd66626159776a8017b3c18579b9Pirama Arumuga Nainar!4 = !DIFile(filename: "test", directory: "/path/to/somewhere")
516948897e478cbd66626159776a8017b3c18579b9Pirama Arumuga Nainar!5 = !DISubroutineType(types: !6)
52ebe69fe11e48d322045d5949c83283927a0d790bStephen Hines!6 = !{!7}
536948897e478cbd66626159776a8017b3c18579b9Pirama Arumuga Nainar!7 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
54ebe69fe11e48d322045d5949c83283927a0d790bStephen Hines!8 = !{!9}
55f3ef5332fa3f4d5ec72c178a2b19dac363a19383Pirama Arumuga Nainar!9 = !DILocalVariable(name: "i", line: 6, scope: !10, file: !4, type: !7)
566948897e478cbd66626159776a8017b3c18579b9Pirama Arumuga Nainar!10 = distinct !DILexicalBlock(line: 6, column: 0, file: !25, scope: !3)
57ebe69fe11e48d322045d5949c83283927a0d790bStephen Hines!11 = !{!12, !16, !17}
586948897e478cbd66626159776a8017b3c18579b9Pirama Arumuga Nainar!12 = !DIGlobalVariable(name: "A", line: 1, isLocal: false, isDefinition: true, scope: null, file: !4, type: !13, variable: [1024 x i32]* @A)
596948897e478cbd66626159776a8017b3c18579b9Pirama Arumuga Nainar!13 = !DICompositeType(tag: DW_TAG_array_type, size: 32768, align: 32, baseType: !7, elements: !14)
60ebe69fe11e48d322045d5949c83283927a0d790bStephen Hines!14 = !{!15}
61ebe69fe11e48d322045d5949c83283927a0d790bStephen Hines!15 = !{i32 786465, i64 0, i64 1024}
626948897e478cbd66626159776a8017b3c18579b9Pirama Arumuga Nainar!16 = !DIGlobalVariable(name: "B", line: 2, isLocal: false, isDefinition: true, scope: null, file: !4, type: !13, variable: [1024 x i32]* @B)
636948897e478cbd66626159776a8017b3c18579b9Pirama Arumuga Nainar!17 = !DIGlobalVariable(name: "C", line: 3, isLocal: false, isDefinition: true, scope: null, file: !4, type: !13, variable: [1024 x i32]* @C)
646948897e478cbd66626159776a8017b3c18579b9Pirama Arumuga Nainar!18 = !DILocation(line: 6, scope: !10)
656948897e478cbd66626159776a8017b3c18579b9Pirama Arumuga Nainar!19 = !DILocation(line: 7, scope: !20)
666948897e478cbd66626159776a8017b3c18579b9Pirama Arumuga Nainar!20 = distinct !DILexicalBlock(line: 6, column: 0, file: !25, scope: !10)
676948897e478cbd66626159776a8017b3c18579b9Pirama Arumuga Nainar!24 = !DILocation(line: 9, scope: !3)
686948897e478cbd66626159776a8017b3c18579b9Pirama Arumuga Nainar!25 = !DIFile(filename: "test", directory: "/path/to/somewhere")
694c5e43da7792f75567b693105cc53e3f1992ad98Pirama Arumuga Nainar!26 = !{i32 1, !"Debug Info Version", i32 3}
70