| Sanjay Patel | b653de1 | 2014-09-10 17:58:16 +0000 | [diff] [blame] | 1 | ; RUN: opt < %s -S -loop-vectorize -force-vector-interleave=1 -force-vector-width=4 -dce -instcombine | FileCheck %s | 
| Arnold Schwaighofer | 4090b61 | 2013-03-09 15:56:34 +0000 | [diff] [blame] | 2 | ; Make sure we vectorize with debugging turned on. | 
|  | 3 |  | 
|  | 4 | target 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" | 
|  | 5 | target triple = "x86_64-apple-macosx10.8.0" | 
|  | 6 |  | 
|  | 7 | @A = global [1024 x i32] zeroinitializer, align 16 | 
|  | 8 | @B = global [1024 x i32] zeroinitializer, align 16 | 
|  | 9 | @C = global [1024 x i32] zeroinitializer, align 16 | 
|  | 10 |  | 
| Stephen Lin | c1c7a13 | 2013-07-14 01:42:54 +0000 | [diff] [blame] | 11 | ; CHECK-LABEL: @test( | 
| Peter Collingbourne | d4bff30 | 2015-11-05 22:03:56 +0000 | [diff] [blame] | 12 | define i32 @test() #0 !dbg !3 { | 
| Arnold Schwaighofer | 4090b61 | 2013-03-09 15:56:34 +0000 | [diff] [blame] | 13 | entry: | 
| Duncan P. N. Exon Smith | a9308c4 | 2015-04-29 16:38:44 +0000 | [diff] [blame] | 14 | tail call void @llvm.dbg.value(metadata i32 0, i64 0, metadata !9, metadata !DIExpression()), !dbg !18 | 
| Arnold Schwaighofer | 4090b61 | 2013-03-09 15:56:34 +0000 | [diff] [blame] | 15 | br label %for.body, !dbg !18 | 
|  | 16 |  | 
|  | 17 | for.body: | 
|  | 18 | ;CHECK: load <4 x i32> | 
|  | 19 | %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ] | 
| David Blaikie | 79e6c74 | 2015-02-27 19:29:02 +0000 | [diff] [blame] | 20 | %arrayidx = getelementptr inbounds [1024 x i32], [1024 x i32]* @B, i64 0, i64 %indvars.iv, !dbg !19 | 
| David Blaikie | a79ac14 | 2015-02-27 21:17:42 +0000 | [diff] [blame] | 21 | %0 = load i32, i32* %arrayidx, align 4, !dbg !19 | 
| David Blaikie | 79e6c74 | 2015-02-27 19:29:02 +0000 | [diff] [blame] | 22 | %arrayidx2 = getelementptr inbounds [1024 x i32], [1024 x i32]* @C, i64 0, i64 %indvars.iv, !dbg !19 | 
| David Blaikie | a79ac14 | 2015-02-27 21:17:42 +0000 | [diff] [blame] | 23 | %1 = load i32, i32* %arrayidx2, align 4, !dbg !19 | 
| Arnold Schwaighofer | 4090b61 | 2013-03-09 15:56:34 +0000 | [diff] [blame] | 24 | %add = add nsw i32 %1, %0, !dbg !19 | 
| David Blaikie | 79e6c74 | 2015-02-27 19:29:02 +0000 | [diff] [blame] | 25 | %arrayidx4 = getelementptr inbounds [1024 x i32], [1024 x i32]* @A, i64 0, i64 %indvars.iv, !dbg !19 | 
| Manman Ren | 1a5ff28 | 2013-04-30 17:52:57 +0000 | [diff] [blame] | 26 | store i32 %add, i32* %arrayidx4, align 4, !dbg !19 | 
| Arnold Schwaighofer | 4090b61 | 2013-03-09 15:56:34 +0000 | [diff] [blame] | 27 | %indvars.iv.next = add i64 %indvars.iv, 1, !dbg !18 | 
| Duncan P. N. Exon Smith | a9308c4 | 2015-04-29 16:38:44 +0000 | [diff] [blame] | 28 | tail call void @llvm.dbg.value(metadata !{null}, i64 0, metadata !9, metadata !DIExpression()), !dbg !18 | 
| Arnold Schwaighofer | 4090b61 | 2013-03-09 15:56:34 +0000 | [diff] [blame] | 29 | %lftr.wideiv = trunc i64 %indvars.iv.next to i32, !dbg !18 | 
|  | 30 | %exitcond = icmp ne i32 %lftr.wideiv, 1024, !dbg !18 | 
|  | 31 | br i1 %exitcond, label %for.body, label %for.end, !dbg !18 | 
|  | 32 |  | 
|  | 33 | for.end: | 
|  | 34 | ret i32 0, !dbg !24 | 
|  | 35 | } | 
|  | 36 |  | 
| Adrian Prantl | 87b7eb9 | 2014-10-01 18:55:02 +0000 | [diff] [blame] | 37 | declare void @llvm.dbg.declare(metadata, metadata, metadata) #1 | 
| Arnold Schwaighofer | 4090b61 | 2013-03-09 15:56:34 +0000 | [diff] [blame] | 38 |  | 
| Adrian Prantl | 87b7eb9 | 2014-10-01 18:55:02 +0000 | [diff] [blame] | 39 | declare void @llvm.dbg.value(metadata, i64, metadata, metadata) #1 | 
| Arnold Schwaighofer | 4090b61 | 2013-03-09 15:56:34 +0000 | [diff] [blame] | 40 |  | 
| Bill Wendling | a5c536e | 2013-08-01 21:42:05 +0000 | [diff] [blame] | 41 | attributes #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" } | 
| Arnold Schwaighofer | 4090b61 | 2013-03-09 15:56:34 +0000 | [diff] [blame] | 42 | attributes #1 = { nounwind readnone } | 
|  | 43 |  | 
|  | 44 | !llvm.dbg.cu = !{!0} | 
| Manman Ren | 409558f | 2013-11-22 21:49:45 +0000 | [diff] [blame] | 45 | !llvm.module.flags = !{!26} | 
| Arnold Schwaighofer | 4090b61 | 2013-03-09 15:56:34 +0000 | [diff] [blame] | 46 |  | 
| Duncan P. N. Exon Smith | 55ca964 | 2015-08-03 17:26:41 +0000 | [diff] [blame] | 47 | !0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, producer: "clang", isOptimized: true, emissionKind: 0, file: !25, enums: !1, retainedTypes: !1, subprograms: !2, globals: !11) | 
| Duncan P. N. Exon Smith | 988a7f8 | 2015-03-27 20:46:33 +0000 | [diff] [blame] | 48 | !1 = !{} | 
| Duncan P. N. Exon Smith | be7ea19 | 2014-12-15 19:07:53 +0000 | [diff] [blame] | 49 | !2 = !{!3} | 
| Peter Collingbourne | d4bff30 | 2015-11-05 22:03:56 +0000 | [diff] [blame] | 50 | !3 = distinct !DISubprogram(name: "test", linkageName: "test", line: 5, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: true, scopeLine: 5, file: !25, scope: !4, type: !5, variables: !8) | 
| Duncan P. N. Exon Smith | a9308c4 | 2015-04-29 16:38:44 +0000 | [diff] [blame] | 51 | !4 = !DIFile(filename: "test", directory: "/path/to/somewhere") | 
|  | 52 | !5 = !DISubroutineType(types: !6) | 
| Duncan P. N. Exon Smith | be7ea19 | 2014-12-15 19:07:53 +0000 | [diff] [blame] | 53 | !6 = !{!7} | 
| Duncan P. N. Exon Smith | a9308c4 | 2015-04-29 16:38:44 +0000 | [diff] [blame] | 54 | !7 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed) | 
| Duncan P. N. Exon Smith | be7ea19 | 2014-12-15 19:07:53 +0000 | [diff] [blame] | 55 | !8 = !{!9} | 
| Duncan P. N. Exon Smith | ed013cd | 2015-07-31 18:58:39 +0000 | [diff] [blame] | 56 | !9 = !DILocalVariable(name: "i", line: 6, scope: !10, file: !4, type: !7) | 
| Duncan P. N. Exon Smith | a9308c4 | 2015-04-29 16:38:44 +0000 | [diff] [blame] | 57 | !10 = distinct !DILexicalBlock(line: 6, column: 0, file: !25, scope: !3) | 
| Duncan P. N. Exon Smith | be7ea19 | 2014-12-15 19:07:53 +0000 | [diff] [blame] | 58 | !11 = !{!12, !16, !17} | 
| Duncan P. N. Exon Smith | a9308c4 | 2015-04-29 16:38:44 +0000 | [diff] [blame] | 59 | !12 = !DIGlobalVariable(name: "A", line: 1, isLocal: false, isDefinition: true, scope: null, file: !4, type: !13, variable: [1024 x i32]* @A) | 
|  | 60 | !13 = !DICompositeType(tag: DW_TAG_array_type, size: 32768, align: 32, baseType: !7, elements: !14) | 
| Duncan P. N. Exon Smith | be7ea19 | 2014-12-15 19:07:53 +0000 | [diff] [blame] | 61 | !14 = !{!15} | 
|  | 62 | !15 = !{i32 786465, i64 0, i64 1024} | 
| Duncan P. N. Exon Smith | a9308c4 | 2015-04-29 16:38:44 +0000 | [diff] [blame] | 63 | !16 = !DIGlobalVariable(name: "B", line: 2, isLocal: false, isDefinition: true, scope: null, file: !4, type: !13, variable: [1024 x i32]* @B) | 
|  | 64 | !17 = !DIGlobalVariable(name: "C", line: 3, isLocal: false, isDefinition: true, scope: null, file: !4, type: !13, variable: [1024 x i32]* @C) | 
|  | 65 | !18 = !DILocation(line: 6, scope: !10) | 
|  | 66 | !19 = !DILocation(line: 7, scope: !20) | 
|  | 67 | !20 = distinct !DILexicalBlock(line: 6, column: 0, file: !25, scope: !10) | 
|  | 68 | !24 = !DILocation(line: 9, scope: !3) | 
|  | 69 | !25 = !DIFile(filename: "test", directory: "/path/to/somewhere") | 
| Duncan P. N. Exon Smith | e274180 | 2015-03-03 17:24:31 +0000 | [diff] [blame] | 70 | !26 = !{i32 1, !"Debug Info Version", i32 3} |