xref: /llvm-project/llvm/test/Transforms/InstCombine/dbg-simplify-alloca-size.ll (revision 094572701dce4aaf36f4521d6cf750420d39f206)
1; RUN: opt -S --passes=instcombine %s | FileCheck %s
2; RUN: opt --try-experimental-debuginfo-iterators -S --passes=instcombine %s | FileCheck %s
3
4; https://github.com/llvm/llvm-project/issues/56807
5declare void @foo(ptr %pixels)
6
7declare void @llvm.dbg.declare(metadata, metadata, metadata)
8
9; CHECK-LABEL: @toplevel(
10; CHECK:  entry:
11; CHECK-NEXT:    %pixels1 = alloca [3 x i8], align 1
12; CHECK-NEXT:    #dbg_declare(ptr %pixels1, ![[MD:[0-9]+]], !DIExpression(), ![[DBG:[0-9]+]]
13; CHECK-NEXT:    call void @foo(ptr nonnull %pixels1)
14; CHECK-NEXT:    ret void
15define dso_local void @toplevel() {
16entry:
17  %pixels = alloca i8, i32 3
18  call void @llvm.dbg.declare(metadata ptr %pixels, metadata !11, metadata !DIExpression()), !dbg !12
19  call void @foo(ptr %pixels)
20  ret void
21}
22
23!llvm.dbg.cu = !{!0}
24!llvm.module.flags = !{!3, !4, !5}
25
26!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus_14, file: !1, producer: "clang version 11.1.0", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, splitDebugInlining: false, nameTableKind: None)
27!1 = !DIFile(filename: "test.cpp", directory: "/path/to/test_cpp")
28!2 = !{}
29!3 = !{i32 7, !"Dwarf Version", i32 4}
30!4 = !{i32 2, !"Debug Info Version", i32 3}
31!5 = !{i32 1, !"wchar_size", i32 4}
32!7 = distinct !DISubprogram(name: "toplevel", linkageName: "_Z8toplevelv", scope: !1, file: !1, line: 9, type: !8, scopeLine: 9, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !2)
33!8 = !DISubroutineType(types: !9)
34!9 = !{!10, !10}
35!10 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
36; CHECK: ![[MD]] = !DILocalVariable(name: "pixels"
37!11 = !DILocalVariable(name: "pixels", arg: 1, scope: !7, file: !1, line: 9, type: !10)
38; CHECK: ![[DBG]] = !DILocation(line: 9, column: 16,
39!12 = !DILocation(line: 9, column: 16, scope: !7)
40
41