1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py 2; RUN: opt < %s -passes=slp-vectorizer,dce -S -mtriple=x86_64-apple-macosx10.8.0 -mcpu=corei7-avx | FileCheck %s 3 4target 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" 5target triple = "x86_64-apple-macosx10.7.0" 6 7; int depth(ptr A, int m) { 8; double y0 = 0; double y1 = 1; 9; for (int i=0; i < m; i++) { 10; y0 = A[4]; 11; y1 = A[5]; 12; } 13; A[8] = y0; A[8+1] = y1; 14; } 15 16define i32 @depth(ptr nocapture %A, i32 %m) #0 !dbg !4 { 17; CHECK-LABEL: @depth( 18; CHECK-NEXT: entry: 19; CHECK-NEXT: #dbg_value(ptr [[A:%.*]], [[META12:![0-9]+]], !DIExpression(), [[META18:![0-9]+]]) 20; CHECK-NEXT: #dbg_value(i32 [[M:%.*]], [[META13:![0-9]+]], !DIExpression(), [[META18]]) 21; CHECK-NEXT: #dbg_value(double 0.000000e+00, [[META14:![0-9]+]], !DIExpression(), [[META19:![0-9]+]]) 22; CHECK-NEXT: #dbg_value(double 2.000000e-01, [[META15:![0-9]+]], !DIExpression(), [[META19]]) 23; CHECK-NEXT: #dbg_value(i32 0, [[META16:![0-9]+]], !DIExpression(), [[META20:![0-9]+]]) 24; CHECK-NEXT: [[CMP8:%.*]] = icmp sgt i32 [[M]], 0, !dbg [[META20]] 25; CHECK-NEXT: br i1 [[CMP8]], label [[FOR_BODY_LR_PH:%.*]], label [[FOR_END:%.*]], !dbg [[META20]] 26; CHECK: for.body.lr.ph: 27; CHECK-NEXT: [[ARRAYIDX:%.*]] = getelementptr inbounds double, ptr [[A]], i64 4, !dbg [[DBG21:![0-9]+]] 28; CHECK-NEXT: [[TMP0:%.*]] = load <2 x double>, ptr [[ARRAYIDX]], align 8, !dbg [[DBG21]] 29; CHECK-NEXT: br label [[FOR_END]], !dbg [[META20]] 30; CHECK: for.end: 31; CHECK-NEXT: [[TMP1:%.*]] = phi <2 x double> [ [[TMP0]], [[FOR_BODY_LR_PH]] ], [ <double 0.000000e+00, double 1.000000e+00>, [[ENTRY:%.*]] ] 32; CHECK-NEXT: [[ARRAYIDX2:%.*]] = getelementptr inbounds double, ptr [[A]], i64 8, !dbg [[DBG23:![0-9]+]] 33; CHECK-NEXT: store <2 x double> [[TMP1]], ptr [[ARRAYIDX2]], align 8, !dbg [[DBG23]] 34; CHECK-NEXT: ret i32 undef, !dbg [[DBG24:![0-9]+]] 35; 36entry: 37 tail call void @llvm.dbg.value(metadata ptr %A, i64 0, metadata !12, metadata !DIExpression()), !dbg !19 38 tail call void @llvm.dbg.value(metadata i32 %m, i64 0, metadata !13, metadata !DIExpression()), !dbg !19 39 tail call void @llvm.dbg.value(metadata double 0.0, i64 0, metadata !14, metadata !DIExpression()), !dbg !21 40 tail call void @llvm.dbg.value(metadata double 0.2, i64 0, metadata !15, metadata !DIExpression()), !dbg !21 41 tail call void @llvm.dbg.value(metadata i32 0, i64 0, metadata !16, metadata !DIExpression()), !dbg !23 42 %cmp8 = icmp sgt i32 %m, 0, !dbg !23 43 br i1 %cmp8, label %for.body.lr.ph, label %for.end, !dbg !23 44 45for.body.lr.ph: ; preds = %entry 46 %arrayidx = getelementptr inbounds double, ptr %A, i64 4, !dbg !24 47 %0 = load double, ptr %arrayidx, align 8, !dbg !24 48 %arrayidx1 = getelementptr inbounds double, ptr %A, i64 5, !dbg !29 49 %1 = load double, ptr %arrayidx1, align 8, !dbg !29 50 br label %for.end, !dbg !23 51 52for.end: ; preds = %for.body.lr.ph, %entry 53 %y1.0.lcssa = phi double [ %1, %for.body.lr.ph ], [ 1.000000e+00, %entry ] 54 %y0.0.lcssa = phi double [ %0, %for.body.lr.ph ], [ 0.000000e+00, %entry ] 55 %arrayidx2 = getelementptr inbounds double, ptr %A, i64 8, !dbg !30 56 store double %y0.0.lcssa, ptr %arrayidx2, align 8, !dbg !30 57 %arrayidx3 = getelementptr inbounds double, ptr %A, i64 9, !dbg !30 58 store double %y1.0.lcssa, ptr %arrayidx3, align 8, !dbg !30 59 ret i32 undef, !dbg !31 60} 61 62; Function Attrs: nounwind readnone 63declare void @llvm.dbg.value(metadata, i64, metadata, metadata) #1 64 65attributes #0 = { nounwind ssp uwtable "less-precise-fpmad"="false" "frame-pointer"="all" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" } 66attributes #1 = { nounwind readnone } 67 68!llvm.dbg.cu = !{!0} 69!llvm.module.flags = !{!18, !32} 70 71!0 = distinct !DICompileUnit(language: DW_LANG_C99, producer: "clang version 3.4 (trunk 187335) (llvm/trunk 187335:187340M)", isOptimized: true, emissionKind: FullDebug, file: !1, enums: !2, retainedTypes: !2, globals: !2, imports: !2) 72!1 = !DIFile(filename: "file.c", directory: "/Users/nadav") 73!2 = !{} 74!4 = distinct !DISubprogram(name: "depth", line: 1, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: true, unit: !0, scopeLine: 1, file: !1, scope: !5, type: !6, retainedNodes: !11) 75!5 = !DIFile(filename: "file.c", directory: "/Users/nadav") 76!6 = !DISubroutineType(types: !7) 77!7 = !{!8, !9, !8} 78!8 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed) 79!9 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, baseType: !10) 80!10 = !DIBasicType(tag: DW_TAG_base_type, name: "double", size: 64, align: 64, encoding: DW_ATE_float) 81!11 = !{!12, !13, !14, !15, !16} 82!12 = !DILocalVariable(name: "A", line: 1, arg: 1, scope: !4, file: !5, type: !9) 83!13 = !DILocalVariable(name: "m", line: 1, arg: 2, scope: !4, file: !5, type: !8) 84!14 = !DILocalVariable(name: "y0", line: 2, scope: !4, file: !5, type: !10) 85!15 = !DILocalVariable(name: "y1", line: 2, scope: !4, file: !5, type: !10) 86!16 = !DILocalVariable(name: "i", line: 3, scope: !17, file: !5, type: !8) 87!17 = distinct !DILexicalBlock(line: 3, column: 0, file: !1, scope: !4) 88!18 = !{i32 2, !"Dwarf Version", i32 2} 89!19 = !DILocation(line: 1, scope: !4) 90!20 = !{double 0.000000e+00} 91!21 = !DILocation(line: 2, scope: !4) 92!22 = !{double 1.000000e+00} 93!23 = !DILocation(line: 3, scope: !17) 94!24 = !DILocation(line: 4, scope: !25) 95!25 = distinct !DILexicalBlock(line: 3, column: 0, file: !1, scope: !17) 96!29 = !DILocation(line: 5, scope: !25) 97!30 = !DILocation(line: 7, scope: !4) 98!31 = !DILocation(line: 8, scope: !4) 99!32 = !{i32 1, !"Debug Info Version", i32 3} 100