1 ; RUN: llc < %s | FileCheck %s 2 ; RUN: llc < %s -regalloc=basic | FileCheck %s 3 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" 4 target triple = "x86_64-apple-darwin10.0.0" 5 6 ; Check debug info for variable z_s 7 ;CHECK: .ascii "z_s" ## DW_AT_name 8 ;CHECK-NEXT: .byte 0 9 ;CHECK-NEXT: ## DW_AT_decl_file 10 ;CHECK-NEXT: ## DW_AT_decl_line 11 ;CHECK-NEXT: ## DW_AT_type 12 ;CHECK-NEXT: ## DW_AT_location 13 14 15 @.str1 = private unnamed_addr constant [14 x i8] c"m=%u, z_s=%d\0A\00" 16 @str = internal constant [21 x i8] c"Failing test vector:\00" 17 18 define i64 @gcd(i64 %a, i64 %b) nounwind readnone optsize noinline ssp { 19 entry: 20 tail call void @llvm.dbg.value(metadata !{i64 %a}, i64 0, metadata !10), !dbg !18 21 tail call void @llvm.dbg.value(metadata !{i64 %b}, i64 0, metadata !11), !dbg !19 22 br label %while.body, !dbg !20 23 24 while.body: ; preds = %while.body, %entry 25 %b.addr.0 = phi i64 [ %b, %entry ], [ %rem, %while.body ] 26 %a.addr.0 = phi i64 [ %a, %entry ], [ %b.addr.0, %while.body ] 27 %rem = srem i64 %a.addr.0, %b.addr.0, !dbg !21 28 %cmp = icmp eq i64 %rem, 0, !dbg !23 29 br i1 %cmp, label %if.then, label %while.body, !dbg !23 30 31 if.then: ; preds = %while.body 32 tail call void @llvm.dbg.value(metadata !{i64 %rem}, i64 0, metadata !12), !dbg !21 33 ret i64 %b.addr.0, !dbg !23 34 } 35 36 define i32 @main() nounwind optsize ssp { 37 entry: 38 %call = tail call i32 @rand() nounwind optsize, !dbg !24 39 tail call void @llvm.dbg.value(metadata !{i32 %call}, i64 0, metadata !14), !dbg !24 40 %cmp = icmp ugt i32 %call, 21, !dbg !25 41 br i1 %cmp, label %cond.true, label %cond.end, !dbg !25 42 43 cond.true: ; preds = %entry 44 %call1 = tail call i32 @rand() nounwind optsize, !dbg !25 45 br label %cond.end, !dbg !25 46 47 cond.end: ; preds = %entry, %cond.true 48 %cond = phi i32 [ %call1, %cond.true ], [ %call, %entry ], !dbg !25 49 tail call void @llvm.dbg.value(metadata !{i32 %cond}, i64 0, metadata !17), !dbg !25 50 %conv = sext i32 %cond to i64, !dbg !26 51 %conv5 = zext i32 %call to i64, !dbg !26 52 %call6 = tail call i64 @gcd(i64 %conv, i64 %conv5) optsize, !dbg !26 53 %cmp7 = icmp eq i64 %call6, 0 54 br i1 %cmp7, label %return, label %if.then, !dbg !26 55 56 if.then: ; preds = %cond.end 57 %puts = tail call i32 @puts(i8* getelementptr inbounds ([21 x i8]* @str, i64 0, i64 0)) 58 %call12 = tail call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([14 x i8]* @.str1, i64 0, i64 0), i32 %call, i32 %cond) nounwind optsize, !dbg !26 59 ret i32 1, !dbg !27 60 61 return: ; preds = %cond.end 62 ret i32 0, !dbg !27 63 } 64 65 declare i32 @rand() optsize 66 67 declare i32 @printf(i8* nocapture, ...) nounwind optsize 68 69 declare void @llvm.dbg.value(metadata, i64, metadata) nounwind readnone 70 71 declare i32 @puts(i8* nocapture) nounwind 72 73 !llvm.dbg.sp = !{!0, !6} 74 !llvm.dbg.lv.gcd = !{!10, !11, !12} 75 !llvm.dbg.lv.main = !{!14, !17} 76 77 !0 = metadata !{i32 589870, i32 0, metadata !1, metadata !"gcd", metadata !"gcd", metadata !"", metadata !1, i32 5, metadata !3, i1 false, i1 true, i32 0, i32 0, i32 0, i32 256, i1 true, i64 (i64, i64)* @gcd} ; [ DW_TAG_subprogram ] 78 !1 = metadata !{i32 589865, metadata !"rem_small.c", metadata !"/private/tmp", metadata !2} ; [ DW_TAG_file_type ] 79 !2 = metadata !{i32 589841, i32 0, i32 12, metadata !"rem_small.c", metadata !"/private/tmp", metadata !"clang version 2.9 (trunk 124117)", i1 true, i1 true, metadata !"", i32 0} ; [ DW_TAG_compile_unit ] 80 !3 = metadata !{i32 589845, metadata !1, metadata !"", metadata !1, i32 0, i64 0, i64 0, i32 0, i32 0, i32 0, metadata !4, i32 0, i32 0} ; [ DW_TAG_subroutine_type ] 81 !4 = metadata !{metadata !5} 82 !5 = metadata !{i32 589860, metadata !2, metadata !"long int", null, i32 0, i64 64, i64 64, i64 0, i32 0, i32 5} ; [ DW_TAG_base_type ] 83 !6 = metadata !{i32 589870, i32 0, metadata !1, metadata !"main", metadata !"main", metadata !"", metadata !1, i32 25, metadata !7, i1 false, i1 true, i32 0, i32 0, i32 0, i32 0, i1 true, i32 ()* @main} ; [ DW_TAG_subprogram ] 84 !7 = metadata !{i32 589845, metadata !1, metadata !"", metadata !1, i32 0, i64 0, i64 0, i32 0, i32 0, i32 0, metadata !8, i32 0, i32 0} ; [ DW_TAG_subroutine_type ] 85 !8 = metadata !{metadata !9} 86 !9 = metadata !{i32 589860, metadata !2, metadata !"int", null, i32 0, i64 32, i64 32, i64 0, i32 0, i32 5} ; [ DW_TAG_base_type ] 87 !10 = metadata !{i32 590081, metadata !0, metadata !"a", metadata !1, i32 5, metadata !5, i32 0} ; [ DW_TAG_arg_variable ] 88 !11 = metadata !{i32 590081, metadata !0, metadata !"b", metadata !1, i32 5, metadata !5, i32 0} ; [ DW_TAG_arg_variable ] 89 !12 = metadata !{i32 590080, metadata !13, metadata !"c", metadata !1, i32 6, metadata !5, i32 0} ; [ DW_TAG_auto_variable ] 90 !13 = metadata !{i32 589835, metadata !0, i32 5, i32 52, metadata !1, i32 0} ; [ DW_TAG_lexical_block ] 91 !14 = metadata !{i32 590080, metadata !15, metadata !"m", metadata !1, i32 26, metadata !16, i32 0} ; [ DW_TAG_auto_variable ] 92 !15 = metadata !{i32 589835, metadata !6, i32 25, i32 12, metadata !1, i32 2} ; [ DW_TAG_lexical_block ] 93 !16 = metadata !{i32 589860, metadata !2, metadata !"unsigned int", null, i32 0, i64 32, i64 32, i64 0, i32 0, i32 7} ; [ DW_TAG_base_type ] 94 !17 = metadata !{i32 590080, metadata !15, metadata !"z_s", metadata !1, i32 27, metadata !9, i32 0} ; [ DW_TAG_auto_variable ] 95 !18 = metadata !{i32 5, i32 41, metadata !0, null} 96 !19 = metadata !{i32 5, i32 49, metadata !0, null} 97 !20 = metadata !{i32 7, i32 5, metadata !13, null} 98 !21 = metadata !{i32 8, i32 9, metadata !22, null} 99 !22 = metadata !{i32 589835, metadata !13, i32 7, i32 14, metadata !1, i32 1} ; [ DW_TAG_lexical_block ] 100 !23 = metadata !{i32 9, i32 9, metadata !22, null} 101 !24 = metadata !{i32 26, i32 38, metadata !15, null} 102 !25 = metadata !{i32 27, i32 38, metadata !15, null} 103 !26 = metadata !{i32 28, i32 9, metadata !15, null} 104 !27 = metadata !{i32 30, i32 1, metadata !15, null} 105