brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.6 KiB · 5f654f1 Raw
58 lines · plain
1; RUN: opt -safe-stack -S -mtriple=i386-pc-linux-gnu < %s -o - | FileCheck %s2; RUN: opt -passes=safe-stack -S -mtriple=i386-pc-linux-gnu < %s -o - | FileCheck %s3 4; Test llvm.dbg.value for dynamic allocas moved onto the unsafe stack.5; In the dynamic alloca case, the dbg.value does not change with the exception6; of the alloca pointer in the first argument being replaced with the new stack7; top address.8 9target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"10target triple = "x86_64-unknown-linux-gnu"11 12define void @f(i32 %n) safestack !dbg !6 {13entry:14  tail call void @llvm.dbg.value(metadata i32 %n, metadata !11, metadata !14), !dbg !1515  %0 = zext i32 %n to i64, !dbg !1616 17; CHECK:  store ptr %[[VLA:.*]], ptr @__safestack_unsafe_stack_ptr18; CHECK:  #dbg_value(ptr %[[VLA]], ![[TYPE:.*]], !DIExpression(DW_OP_deref),19; CHECK:  call void @capture({{.*}} %[[VLA]])20 21  %vla = alloca i8, i64 %0, align 16, !dbg !1622  tail call void @llvm.dbg.value(metadata ptr %vla, metadata !12, metadata !17), !dbg !1823  call void @capture(ptr nonnull %vla), !dbg !1924  ret void, !dbg !2025}26 27declare void @capture(ptr)28declare void @llvm.dbg.value(metadata, metadata, metadata)29 30!llvm.dbg.cu = !{!0}31!llvm.module.flags = !{!3, !4}32!llvm.ident = !{!5}33 34!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !1, producer: "clang version 3.9.0 (trunk 272832) (llvm/trunk 272831)", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2)35!1 = !DIFile(filename: "../llvm/1.cc", directory: "/code/build-llvm")36!2 = !{}37!3 = !{i32 2, !"Dwarf Version", i32 4}38!4 = !{i32 2, !"Debug Info Version", i32 3}39!5 = !{!"clang version 3.9.0 (trunk 272832) (llvm/trunk 272831)"}40!6 = distinct !DISubprogram(name: "f", linkageName: "_Z1fi", scope: !1, file: !1, line: 2, type: !7, isLocal: false, isDefinition: true, scopeLine: 2, flags: DIFlagPrototyped, isOptimized: true, unit: !0, retainedNodes: !10)41!7 = !DISubroutineType(types: !8)42!8 = !{null, !9}43!9 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed)44!10 = !{!11, !12}45!11 = !DILocalVariable(name: "n", arg: 1, scope: !6, file: !1, line: 2, type: !9)46 47; CHECK-DAG: ![[TYPE]] = !DILocalVariable(name: "x",48!12 = !DILocalVariable(name: "x", scope: !6, file: !1, line: 3, type: !13)49!13 = !DIBasicType(name: "char", size: 8, align: 8, encoding: DW_ATE_signed_char)50!14 = !DIExpression()51!15 = !DILocation(line: 2, column: 12, scope: !6)52!16 = !DILocation(line: 3, column: 3, scope: !6)53 54!17 = !DIExpression(DW_OP_deref)55!18 = !DILocation(line: 3, column: 8, scope: !6)56!19 = !DILocation(line: 4, column: 3, scope: !6)57!20 = !DILocation(line: 5, column: 1, scope: !6)58