1*9880d681SAndroid Build Coastguard Worker; RUN: opt -analyze -scalar-evolution < %s | FileCheck %s 2*9880d681SAndroid Build Coastguard Worker 3*9880d681SAndroid Build Coastguard Worker; Make sure poison value tracking works in the presence of @llvm.dbg 4*9880d681SAndroid Build Coastguard Worker; intrinsics. Unfortunately, I was not able to reduce this file 5*9880d681SAndroid Build Coastguard Worker; further while still keeping the debug info well formed. 6*9880d681SAndroid Build Coastguard Worker 7*9880d681SAndroid Build Coastguard Workerdefine void @foo(i32 %n, i32* %arr) !dbg !7 { 8*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: Classifying expressions for: @foo 9*9880d681SAndroid Build Coastguard Workerentry: 10*9880d681SAndroid Build Coastguard Worker %cmp1 = icmp slt i32 0, %n, !dbg !12 11*9880d681SAndroid Build Coastguard Worker br i1 %cmp1, label %for.body.lr.ph, label %for.end, !dbg !15 12*9880d681SAndroid Build Coastguard Worker 13*9880d681SAndroid Build Coastguard Workerfor.body.lr.ph: ; preds = %entry 14*9880d681SAndroid Build Coastguard Worker br label %for.body, !dbg !15 15*9880d681SAndroid Build Coastguard Worker 16*9880d681SAndroid Build Coastguard Workerfor.body: ; preds = %for.inc, %for.body.lr.ph 17*9880d681SAndroid Build Coastguard Worker %i.02 = phi i32 [ 0, %for.body.lr.ph ], [ %inc, %for.inc ] 18*9880d681SAndroid Build Coastguard Worker %add = add nsw i32 %i.02, 50, !dbg !16 19*9880d681SAndroid Build Coastguard Worker call void @llvm.dbg.value(metadata i32 %add, i64 0, metadata !18, metadata !19), !dbg !20 20*9880d681SAndroid Build Coastguard Worker %idxprom = sext i32 %add to i64, !dbg !21 21*9880d681SAndroid Build Coastguard Worker 22*9880d681SAndroid Build Coastguard Worker; CHECK: %idxprom = sext i32 %add to i64 23*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: --> {50,+,1}<nuw><nsw><%for.body> 24*9880d681SAndroid Build Coastguard Worker 25*9880d681SAndroid Build Coastguard Worker %arrayidx = getelementptr inbounds i32, i32* %arr, i64 %idxprom, !dbg !21 26*9880d681SAndroid Build Coastguard Worker store i32 100, i32* %arrayidx, align 4, !dbg !22 27*9880d681SAndroid Build Coastguard Worker br label %for.inc, !dbg !23 28*9880d681SAndroid Build Coastguard Worker 29*9880d681SAndroid Build Coastguard Workerfor.inc: ; preds = %for.body 30*9880d681SAndroid Build Coastguard Worker %inc = add nsw i32 %i.02, 1, !dbg !24 31*9880d681SAndroid Build Coastguard Worker %cmp = icmp slt i32 %inc, %n, !dbg !12 32*9880d681SAndroid Build Coastguard Worker br i1 %cmp, label %for.body, label %for.cond.for.end_crit_edge, !dbg !15, !llvm.loop !25 33*9880d681SAndroid Build Coastguard Worker 34*9880d681SAndroid Build Coastguard Workerfor.cond.for.end_crit_edge: ; preds = %for.inc 35*9880d681SAndroid Build Coastguard Worker br label %for.end, !dbg !15 36*9880d681SAndroid Build Coastguard Worker 37*9880d681SAndroid Build Coastguard Workerfor.end: ; preds = %for.cond.for.end_crit_edge, %entry 38*9880d681SAndroid Build Coastguard Worker ret void, !dbg !27 39*9880d681SAndroid Build Coastguard Worker} 40*9880d681SAndroid Build Coastguard Worker 41*9880d681SAndroid Build Coastguard Worker; Function Attrs: nounwind readnone 42*9880d681SAndroid Build Coastguard Workerdeclare void @llvm.dbg.value(metadata, i64, metadata, metadata) 43*9880d681SAndroid Build Coastguard Worker 44*9880d681SAndroid Build Coastguard Worker!llvm.dbg.cu = !{!0} 45*9880d681SAndroid Build Coastguard Worker!llvm.module.flags = !{!3, !4, !5} 46*9880d681SAndroid Build Coastguard Worker!llvm.ident = !{!6} 47*9880d681SAndroid Build Coastguard Worker 48*9880d681SAndroid Build Coastguard Worker!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 3.9.0 (llvm/trunk 271857)", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !2) 49*9880d681SAndroid Build Coastguard Worker!1 = !DIFile(filename: "x.c", directory: "/Users/sanjoy/Code/clang/build/debug+asserts-x86") 50*9880d681SAndroid Build Coastguard Worker!2 = !{} 51*9880d681SAndroid Build Coastguard Worker!3 = !{i32 2, !"Dwarf Version", i32 2} 52*9880d681SAndroid Build Coastguard Worker!4 = !{i32 2, !"Debug Info Version", i32 3} 53*9880d681SAndroid Build Coastguard Worker!5 = !{i32 1, !"PIC Level", i32 2} 54*9880d681SAndroid Build Coastguard Worker!6 = !{!"clang version 3.9.0 (llvm/trunk 271857)"} 55*9880d681SAndroid Build Coastguard Worker!7 = distinct !DISubprogram(name: "foo", scope: !1, file: !1, line: 1, type: !8, isLocal: false, isDefinition: true, scopeLine: 1, flags: DIFlagPrototyped, isOptimized: false, unit: !0, variables: !2) 56*9880d681SAndroid Build Coastguard Worker!8 = !DISubroutineType(types: !9) 57*9880d681SAndroid Build Coastguard Worker!9 = !{null, !10, !11} 58*9880d681SAndroid Build Coastguard Worker!10 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed) 59*9880d681SAndroid Build Coastguard Worker!11 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !10, size: 64, align: 64) 60*9880d681SAndroid Build Coastguard Worker!12 = !DILocation(line: 2, column: 24, scope: !13) 61*9880d681SAndroid Build Coastguard Worker!13 = distinct !DILexicalBlock(scope: !14, file: !1, line: 2, column: 6) 62*9880d681SAndroid Build Coastguard Worker!14 = distinct !DILexicalBlock(scope: !7, file: !1, line: 2, column: 6) 63*9880d681SAndroid Build Coastguard Worker!15 = !DILocation(line: 2, column: 6, scope: !14) 64*9880d681SAndroid Build Coastguard Worker!16 = !DILocation(line: 3, column: 14, scope: !17) 65*9880d681SAndroid Build Coastguard Worker!17 = distinct !DILexicalBlock(scope: !13, file: !1, line: 2, column: 34) 66*9880d681SAndroid Build Coastguard Worker!18 = !DILocalVariable(name: "k", scope: !17, file: !1, line: 3, type: !10) 67*9880d681SAndroid Build Coastguard Worker!19 = !DIExpression() 68*9880d681SAndroid Build Coastguard Worker!20 = !DILocation(line: 3, column: 8, scope: !17) 69*9880d681SAndroid Build Coastguard Worker!21 = !DILocation(line: 4, column: 4, scope: !17) 70*9880d681SAndroid Build Coastguard Worker!22 = !DILocation(line: 4, column: 11, scope: !17) 71*9880d681SAndroid Build Coastguard Worker!23 = !DILocation(line: 5, column: 6, scope: !17) 72*9880d681SAndroid Build Coastguard Worker!24 = !DILocation(line: 2, column: 30, scope: !13) 73*9880d681SAndroid Build Coastguard Worker!25 = distinct !{!25, !26} 74*9880d681SAndroid Build Coastguard Worker!26 = !DILocation(line: 2, column: 6, scope: !7) 75*9880d681SAndroid Build Coastguard Worker!27 = !DILocation(line: 6, column: 1, scope: !7) 76