Arthur Eubanks | 7c2f276 | 2020-07-17 17:49:46 -0700 | [diff] [blame] | 1 | ; RUN: opt -S -asan -enable-new-pm=0 -asan-skip-promotable-allocas=0 %s -o - | FileCheck %s |
| 2 | ; RUN: opt -S -passes='asan-function-pipeline' -asan-skip-promotable-allocas=0 %s -o - | FileCheck %s |
Adrian Prantl | 3c6c14d | 2017-12-11 20:43:21 +0000 | [diff] [blame] | 3 | ; Generated from: |
| 4 | ; int bar(int y) { |
| 5 | ; return y + 2; |
| 6 | ; } |
| 7 | |
| 8 | source_filename = "/tmp/t.c" |
| 9 | target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128" |
| 10 | target triple = "x86_64-apple-macosx10.13.0" |
| 11 | |
| 12 | ; Function Attrs: noinline nounwind optnone sanitize_address ssp uwtable |
| 13 | define i32 @foo(i32 %i) #0 !dbg !8 { |
| 14 | entry: |
| 15 | %i.addr = alloca i32, align 4 |
| 16 | store i32 %i, i32* %i.addr, align 4 |
| 17 | call void @llvm.dbg.declare(metadata i32* %i.addr, metadata !12, metadata !DIExpression()), !dbg !13 |
| 18 | |
| 19 | ; CHECK: %asan_local_stack_base = alloca i64 |
| 20 | ; CHECK: %[[ALLOCA:.*]] = ptrtoint i8* %MyAlloca to i64 |
| 21 | ; CHECK: %[[PHI:.*]] = phi i64 {{.*}} %[[ALLOCA]], |
Johannes Altmanninger | 09667bc | 2019-12-02 11:39:28 +0100 | [diff] [blame] | 22 | ; CHECK: store i64 %[[PHI]], i64* %asan_local_stack_base |
Vedant Kumar | 8e77b33 | 2020-02-10 15:37:56 -0800 | [diff] [blame] | 23 | ; CHECK: call void @llvm.dbg.declare(metadata i64* %asan_local_stack_base, metadata [[VAR_I:![0-9]+]], metadata !DIExpression(DW_OP_deref, DW_OP_plus_uconst, 32)), !dbg [[LOC_I:![0-9]+]] |
Adrian Prantl | 3c6c14d | 2017-12-11 20:43:21 +0000 | [diff] [blame] | 24 | %0 = load i32, i32* %i.addr, align 4, !dbg !14 |
| 25 | %add = add nsw i32 %0, 2, !dbg !15 |
| 26 | ret i32 %add, !dbg !16 |
| 27 | } |
| 28 | |
Vedant Kumar | 8e77b33 | 2020-02-10 15:37:56 -0800 | [diff] [blame] | 29 | ; CHECK: [[SCOPE:![0-9]+]] = distinct !DISubprogram(name: "foo" |
| 30 | ; CHECK: [[VAR_I]] = !DILocalVariable(name: "i", arg: 1, scope: [[SCOPE]] |
| 31 | ; CHECK: [[LOC_I]] = !DILocation(line: 1, column: 13, scope: [[SCOPE]] |
| 32 | |
Adrian Prantl | 3c6c14d | 2017-12-11 20:43:21 +0000 | [diff] [blame] | 33 | ; Function Attrs: nounwind readnone speculatable |
| 34 | declare void @llvm.dbg.declare(metadata, metadata, metadata) #1 |
| 35 | |
| 36 | attributes #0 = { noinline nounwind optnone sanitize_address ssp uwtable } |
| 37 | attributes #1 = { nounwind readnone speculatable } |
| 38 | |
| 39 | !llvm.dbg.cu = !{!0} |
| 40 | !llvm.module.flags = !{!3, !4, !5, !6} |
| 41 | !llvm.ident = !{!7} |
| 42 | |
| 43 | !0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 6.0.0 (trunk 320115) (llvm/trunk 320116)", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !2) |
| 44 | !1 = !DIFile(filename: "/tmp/t.c", directory: "/Data/llvm") |
| 45 | !2 = !{} |
| 46 | !3 = !{i32 2, !"Dwarf Version", i32 4} |
| 47 | !4 = !{i32 2, !"Debug Info Version", i32 3} |
| 48 | !5 = !{i32 1, !"wchar_size", i32 4} |
| 49 | !6 = !{i32 7, !"PIC Level", i32 2} |
| 50 | !7 = !{!"clang version 6.0.0 (trunk 320115) (llvm/trunk 320116)"} |
Shiva Chen | 2c86455 | 2018-05-09 02:40:45 +0000 | [diff] [blame] | 51 | !8 = distinct !DISubprogram(name: "foo", scope: !1, file: !1, line: 1, type: !9, isLocal: false, isDefinition: true, scopeLine: 1, flags: DIFlagPrototyped, isOptimized: false, unit: !0, retainedNodes: !2) |
Adrian Prantl | 3c6c14d | 2017-12-11 20:43:21 +0000 | [diff] [blame] | 52 | !9 = !DISubroutineType(types: !10) |
| 53 | !10 = !{!11, !11} |
| 54 | !11 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed) |
| 55 | !12 = !DILocalVariable(name: "i", arg: 1, scope: !8, file: !1, line: 1, type: !11) |
| 56 | !13 = !DILocation(line: 1, column: 13, scope: !8) |
| 57 | !14 = !DILocation(line: 2, column: 10, scope: !8) |
| 58 | !15 = !DILocation(line: 2, column: 12, scope: !8) |
| 59 | !16 = !DILocation(line: 2, column: 3, scope: !8) |