aboutsummaryrefslogtreecommitdiff
path: root/test/CodeGen/X86/2009-02-12-DebugInfoVLA.ll
diff options
context:
space:
mode:
authorDevang Patel <dpatel@apple.com>2010-03-01 18:30:58 +0000
committerDevang Patel <dpatel@apple.com>2010-03-01 18:30:58 +0000
commit2cbb94d53503af0e962067108c60c50e973fa5e5 (patch)
treee854e178190fd7106a7ed4ae9f424b67f104a1fe /test/CodeGen/X86/2009-02-12-DebugInfoVLA.ll
parent0e7d26c200c549d06a73e4d3068a56c3cd6371ff (diff)
Rewrite test to test VLA using new debug info encoding scheme.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97465 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGen/X86/2009-02-12-DebugInfoVLA.ll')
-rw-r--r--test/CodeGen/X86/2009-02-12-DebugInfoVLA.ll133
1 files changed, 71 insertions, 62 deletions
diff --git a/test/CodeGen/X86/2009-02-12-DebugInfoVLA.ll b/test/CodeGen/X86/2009-02-12-DebugInfoVLA.ll
index 72c7ee93a9..0dca14d064 100644
--- a/test/CodeGen/X86/2009-02-12-DebugInfoVLA.ll
+++ b/test/CodeGen/X86/2009-02-12-DebugInfoVLA.ll
@@ -3,74 +3,83 @@
; PR3538
target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128"
target triple = "i386-apple-darwin9"
- %llvm.dbg.anchor.type = type { i32, i32 }
- %llvm.dbg.basictype.type = type { i32, { }*, i8*, { }*, i32, i64, i64, i64, i32, i32 }
- %llvm.dbg.block.type = type { i32, { }* }
- %llvm.dbg.compile_unit.type = type { i32, { }*, i32, i8*, i8*, i8*, i1, i1, i8* }
- %llvm.dbg.composite.type = type { i32, { }*, i8*, { }*, i32, i64, i64, i64, i32, { }*, { }* }
- %llvm.dbg.subprogram.type = type { i32, { }*, { }*, i8*, i8*, i8*, { }*, i32, { }*, i1, i1 }
- %llvm.dbg.subrange.type = type { i32, i64, i64 }
- %llvm.dbg.variable.type = type { i32, { }*, i8*, { }*, i32, { }* }
-@llvm.dbg.compile_units = linkonce constant %llvm.dbg.anchor.type { i32 458752, i32 17 }, section "llvm.metadata" ; <%llvm.dbg.anchor.type*> [#uses=1]
-@.str = internal constant [4 x i8] c"t.c\00", section "llvm.metadata" ; <[4 x i8]*> [#uses=1]
-@.str1 = internal constant [2 x i8] c".\00", section "llvm.metadata" ; <[2 x i8]*> [#uses=1]
-@.str2 = internal constant [6 x i8] c"clang\00", section "llvm.metadata" ; <[6 x i8]*> [#uses=1]
-@llvm.dbg.compile_unit = internal constant %llvm.dbg.compile_unit.type { i32 458769, { }* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.compile_units to { }*), i32 1, i8* getelementptr ([4 x i8]* @.str, i32 0, i32 0), i8* getelementptr ([2 x i8]* @.str1, i32 0, i32 0), i8* getelementptr ([6 x i8]* @.str2, i32 0, i32 0), i1 false, i1 false, i8* null }, section "llvm.metadata" ; <%llvm.dbg.compile_unit.type*> [#uses=1]
-@.str3 = internal constant [4 x i8] c"int\00", section "llvm.metadata" ; <[4 x i8]*> [#uses=1]
-@llvm.dbg.basictype = internal constant %llvm.dbg.basictype.type { i32 458788, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i8* getelementptr ([4 x i8]* @.str3, i32 0, i32 0), { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i32 0, i64 32, i64 32, i64 0, i32 0, i32 5 }, section "llvm.metadata" ; <%llvm.dbg.basictype.type*> [#uses=1]
-@llvm.dbg.subprograms = linkonce constant %llvm.dbg.anchor.type { i32 458752, i32 46 }, section "llvm.metadata" ; <%llvm.dbg.anchor.type*> [#uses=1]
-@.str4 = internal constant [5 x i8] c"test\00", section "llvm.metadata" ; <[5 x i8]*> [#uses=1]
-@llvm.dbg.subprogram = internal constant %llvm.dbg.subprogram.type { i32 458798, { }* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to { }*), { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i8* getelementptr ([5 x i8]* @.str4, i32 0, i32 0), i8* getelementptr ([5 x i8]* @.str4, i32 0, i32 0), i8* null, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i32 3, { }* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype to { }*), i1 false, i1 true }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
-@.str5 = internal constant [2 x i8] c"X\00", section "llvm.metadata" ; <[2 x i8]*> [#uses=1]
-@llvm.dbg.variable = internal constant %llvm.dbg.variable.type { i32 459009, { }* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram to { }*), i8* getelementptr ([2 x i8]* @.str5, i32 0, i32 0), { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i32 3, { }* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype to { }*) }, section "llvm.metadata" ; <%llvm.dbg.variable.type*> [#uses=1]
-@llvm.dbg.block = internal constant %llvm.dbg.block.type { i32 458763, { }* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram to { }*) }, section "llvm.metadata" ; <%llvm.dbg.block.type*> [#uses=1]
-@llvm.dbg.subrange = internal constant %llvm.dbg.subrange.type { i32 458785, i64 0, i64 0 }, section "llvm.metadata" ; <%llvm.dbg.subrange.type*> [#uses=1]
-@llvm.dbg.array = internal constant [1 x { }*] [{ }* bitcast (%llvm.dbg.subrange.type* @llvm.dbg.subrange to { }*)], section "llvm.metadata" ; <[1 x { }*]*> [#uses=1]
-@llvm.dbg.composite = internal constant %llvm.dbg.composite.type { i32 458753, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i8* null, { }* null, i32 0, i64 0, i64 32, i64 0, i32 0, { }* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype to { }*), { }* bitcast ([1 x { }*]* @llvm.dbg.array to { }*) }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
-@.str6 = internal constant [2 x i8] c"Y\00", section "llvm.metadata" ; <[2 x i8]*> [#uses=1]
-@llvm.dbg.variable7 = internal constant %llvm.dbg.variable.type { i32 459008, { }* bitcast (%llvm.dbg.block.type* @llvm.dbg.block to { }*), i8* getelementptr ([2 x i8]* @.str6, i32 0, i32 0), { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i32 4, { }* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite to { }*) }, section "llvm.metadata" ; <%llvm.dbg.variable.type*> [#uses=1]
-
-define i32 @test(i32 %X) nounwind {
+define signext i8 @foo(i8* %s1) nounwind ssp {
entry:
- %retval = alloca i32 ; <i32*> [#uses=1]
- %X.addr = alloca i32 ; <i32*> [#uses=3]
- %saved_stack = alloca i8* ; <i8**> [#uses=2]
- call void @llvm.dbg.func.start({ }* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram to { }*))
- store i32 %X, i32* %X.addr
- %0 = bitcast i32* %X.addr to { }* ; <{ }*> [#uses=1]
- call void @llvm.dbg.declare({ }* %0, { }* bitcast (%llvm.dbg.variable.type* @llvm.dbg.variable to { }*))
- call void @llvm.dbg.region.start({ }* bitcast (%llvm.dbg.block.type* @llvm.dbg.block to { }*))
- call void @llvm.dbg.stoppoint(i32 4, i32 3, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*))
- %1 = call i8* @llvm.stacksave() ; <i8*> [#uses=1]
- store i8* %1, i8** %saved_stack
- %tmp = load i32* %X.addr ; <i32> [#uses=1]
- %2 = mul i32 4, %tmp ; <i32> [#uses=1]
- %vla = alloca i8, i32 %2 ; <i8*> [#uses=1]
- %tmp1 = bitcast i8* %vla to i32* ; <i32*> [#uses=1]
- %3 = bitcast i32* %tmp1 to { }* ; <{ }*> [#uses=1]
- call void @llvm.dbg.declare({ }* %3, { }* bitcast (%llvm.dbg.variable.type* @llvm.dbg.variable7 to { }*))
- call void @llvm.dbg.stoppoint(i32 5, i32 1, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*))
- call void @llvm.dbg.region.end({ }* bitcast (%llvm.dbg.block.type* @llvm.dbg.block to { }*))
- br label %cleanup
+ %s1_addr = alloca i8* ; <i8**> [#uses=2]
+ %retval = alloca i32 ; <i32*> [#uses=2]
+ %saved_stack.1 = alloca i8* ; <i8**> [#uses=2]
+ %0 = alloca i32 ; <i32*> [#uses=2]
+ %str.0 = alloca [0 x i8]* ; <[0 x i8]**> [#uses=3]
+ %1 = alloca i64 ; <i64*> [#uses=2]
+ %2 = alloca i64 ; <i64*> [#uses=1]
+ %3 = alloca i64 ; <i64*> [#uses=6]
+ %"alloca point" = bitcast i32 0 to i32 ; <i32> [#uses=0]
+ call void @llvm.dbg.declare(metadata !{i8** %s1_addr}, metadata !0), !dbg !7
+ store i8* %s1, i8** %s1_addr
+ call void @llvm.dbg.declare(metadata !{[0 x i8]** %str.0}, metadata !8), !dbg !7
+ %4 = call i8* @llvm.stacksave(), !dbg !7 ; <i8*> [#uses=1]
+ store i8* %4, i8** %saved_stack.1, align 8, !dbg !7
+ %5 = load i8** %s1_addr, align 8, !dbg !13 ; <i8*> [#uses=1]
+ %6 = call i64 @strlen(i8* %5) nounwind readonly, !dbg !13 ; <i64> [#uses=1]
+ %7 = add i64 %6, 1, !dbg !13 ; <i64> [#uses=1]
+ store i64 %7, i64* %3, align 8, !dbg !13
+ %8 = load i64* %3, align 8, !dbg !13 ; <i64> [#uses=1]
+ %9 = sub nsw i64 %8, 1, !dbg !13 ; <i64> [#uses=0]
+ %10 = load i64* %3, align 8, !dbg !13 ; <i64> [#uses=1]
+ %11 = mul i64 %10, 8, !dbg !13 ; <i64> [#uses=0]
+ %12 = load i64* %3, align 8, !dbg !13 ; <i64> [#uses=1]
+ store i64 %12, i64* %2, align 8, !dbg !13
+ %13 = load i64* %3, align 8, !dbg !13 ; <i64> [#uses=1]
+ %14 = mul i64 %13, 8, !dbg !13 ; <i64> [#uses=0]
+ %15 = load i64* %3, align 8, !dbg !13 ; <i64> [#uses=1]
+ store i64 %15, i64* %1, align 8, !dbg !13
+ %16 = load i64* %1, align 8, !dbg !13 ; <i64> [#uses=1]
+ %17 = trunc i64 %16 to i32, !dbg !13 ; <i32> [#uses=1]
+ %18 = alloca i8, i32 %17, !dbg !13 ; <i8*> [#uses=1]
+ %19 = bitcast i8* %18 to [0 x i8]*, !dbg !13 ; <[0 x i8]*> [#uses=1]
+ store [0 x i8]* %19, [0 x i8]** %str.0, align 8, !dbg !13
+ %20 = load [0 x i8]** %str.0, align 8, !dbg !15 ; <[0 x i8]*> [#uses=1]
+ %21 = getelementptr inbounds [0 x i8]* %20, i64 0, i64 0, !dbg !15 ; <i8*> [#uses=1]
+ store i8 0, i8* %21, align 1, !dbg !15
+ %22 = load [0 x i8]** %str.0, align 8, !dbg !16 ; <[0 x i8]*> [#uses=1]
+ %23 = getelementptr inbounds [0 x i8]* %22, i64 0, i64 0, !dbg !16 ; <i8*> [#uses=1]
+ %24 = load i8* %23, align 1, !dbg !16 ; <i8> [#uses=1]
+ %25 = sext i8 %24 to i32, !dbg !16 ; <i32> [#uses=1]
+ store i32 %25, i32* %0, align 4, !dbg !16
+ %26 = load i8** %saved_stack.1, align 8, !dbg !16 ; <i8*> [#uses=1]
+ call void @llvm.stackrestore(i8* %26), !dbg !16
+ %27 = load i32* %0, align 4, !dbg !16 ; <i32> [#uses=1]
+ store i32 %27, i32* %retval, align 4, !dbg !16
+ br label %return, !dbg !16
-cleanup: ; preds = %entry
- %tmp2 = load i8** %saved_stack ; <i8*> [#uses=1]
- call void @llvm.stackrestore(i8* %tmp2)
- call void @llvm.dbg.region.end({ }* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram to { }*))
- %4 = load i32* %retval ; <i32> [#uses=1]
- ret i32 %4
+return: ; preds = %entry
+ %retval1 = load i32* %retval, !dbg !16 ; <i32> [#uses=1]
+ %retval12 = trunc i32 %retval1 to i8, !dbg !16 ; <i8> [#uses=1]
+ ret i8 %retval12, !dbg !16
}
-declare void @llvm.dbg.func.start({ }*) nounwind
-
-declare void @llvm.dbg.declare({ }*, { }*) nounwind
-
-declare void @llvm.dbg.region.start({ }*) nounwind
-
-declare void @llvm.dbg.stoppoint(i32, i32, { }*) nounwind
+declare void @llvm.dbg.declare(metadata, metadata) nounwind readnone
declare i8* @llvm.stacksave() nounwind
+declare i64 @strlen(i8*) nounwind readonly
+
declare void @llvm.stackrestore(i8*) nounwind
-declare void @llvm.dbg.region.end({ }*) nounwind
+!0 = metadata !{i32 459009, metadata !1, metadata !"s1", metadata !2, i32 2, metadata !6} ; [ DW_TAG_arg_variable ]
+!1 = metadata !{i32 458798, i32 0, metadata !2, metadata !"foo", metadata !"foo", metadata !"foo", metadata !2, i32 2, metadata !3, i1 false, i1 true, i32 0, i32 0, null, i1 false} ; [ DW_TAG_subprogram ]
+!2 = metadata !{i32 458769, i32 0, i32 1, metadata !"vla.c", metadata !"/tmp/", metadata !"4.2.1 (Based on Apple Inc. build 5658) (LLVM build)", i1 true, i1 false, metadata !"", i32 0} ; [ DW_TAG_compile_unit ]
+!3 = metadata !{i32 458773, metadata !2, metadata !"", metadata !2, i32 0, i64 0, i64 0, i64 0, i32 0, null, metadata !4, i32 0, null} ; [ DW_TAG_subroutine_type ]
+!4 = metadata !{metadata !5, metadata !6}
+!5 = metadata !{i32 458788, metadata !2, metadata !"char", metadata !2, i32 0, i64 8, i64 8, i64 0, i32 0, i32 6} ; [ DW_TAG_base_type ]
+!6 = metadata !{i32 458767, metadata !2, metadata !"", metadata !2, i32 0, i64 64, i64 64, i64 0, i32 0, metadata !5} ; [ DW_TAG_pointer_type ]
+!7 = metadata !{i32 2, i32 0, metadata !1, null}
+!8 = metadata !{i32 459008, metadata !1, metadata !"str.0", metadata !2, i32 3, metadata !9} ; [ DW_TAG_auto_variable ]
+!9 = metadata !{i32 458767, metadata !2, metadata !"", metadata !2, i32 0, i64 64, i64 64, i64 0, i32 64, metadata !10} ; [ DW_TAG_pointer_type ]
+!10 = metadata !{i32 458753, metadata !2, metadata !"", metadata !2, i32 0, i64 8, i64 8, i64 0, i32 0, metadata !5, metadata !11, i32 0, null} ; [ DW_TAG_array_type ]
+!11 = metadata !{metadata !12}
+!12 = metadata !{i32 458785, i64 0, i64 0} ; [ DW_TAG_subrange_type ]
+!13 = metadata !{i32 3, i32 0, metadata !14, null}
+!14 = metadata !{i32 458763, metadata !1, i32 0, i32 0} ; [ DW_TAG_lexical_block ]
+!15 = metadata !{i32 4, i32 0, metadata !14, null}
+!16 = metadata !{i32 5, i32 0, metadata !14, null}