1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; dbg.value intrinsics should not affect peephole combining of stacksave/stackrestore.
4 ; RUN: opt -passes=instcombine %s -S | FileCheck %s
5 ; RUN: opt -passes=instcombine %s -S --try-experimental-debuginfo-iterators | FileCheck %s
7 declare ptr @llvm.stacksave() #0
8 declare void @llvm.stackrestore(ptr) #0
10 define ptr @test1(i32 %P) !dbg !6 {
11 ; CHECK-LABEL: @test1(
12 ; CHECK-NEXT: #dbg_value(ptr poison, [[META9:![0-9]+]], !DIExpression(), [[META12:![0-9]+]])
13 ; CHECK-NEXT: [[TMP1:%.*]] = zext i32 [[P:%.*]] to i64, !dbg [[DBG13:![0-9]+]]
14 ; CHECK-NEXT: [[A:%.*]] = alloca i32, i64 [[TMP1]], align 4, !dbg [[DBG13]]
15 ; CHECK-NEXT: #dbg_value(ptr [[A]], [[META11:![0-9]+]], !DIExpression(), [[DBG13]])
16 ; CHECK-NEXT: ret ptr [[A]], !dbg [[DBG14:![0-9]+]]
18 %tmp = call ptr @llvm.stacksave(), !dbg !12
19 call void @llvm.dbg.value(metadata ptr %tmp, metadata !9, metadata !DIExpression()), !dbg !12
20 call void @llvm.stackrestore(ptr %tmp), !dbg !13
21 %A = alloca i32, i32 %P, !dbg !14
22 call void @llvm.dbg.value(metadata ptr %A, metadata !11, metadata !DIExpression()), !dbg !14
26 declare void @llvm.dbg.value(metadata, metadata, metadata) #1
27 attributes #0 = { nounwind }
28 attributes #1 = { nounwind readnone speculatable }
31 !llvm.debugify = !{!3, !4}
32 !llvm.module.flags = !{!5}
34 !0 = distinct !DICompileUnit(language: DW_LANG_C, file: !1, producer: "debugify", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2)
35 !1 = !DIFile(filename: "patatino.ll", directory: "/")
39 !5 = !{i32 2, !"Debug Info Version", i32 3}
40 !6 = distinct !DISubprogram(name: "test1", linkageName: "test1", scope: null, file: !1, line: 1, type: !7, isLocal: false, isDefinition: true, scopeLine: 1, isOptimized: true, unit: !0, retainedNodes: !8)
41 !7 = !DISubroutineType(types: !2)
43 !9 = !DILocalVariable(name: "1", scope: !6, file: !1, line: 1, type: !10)
44 !10 = !DIBasicType(name: "ty64", size: 64, encoding: DW_ATE_unsigned)
45 !11 = !DILocalVariable(name: "2", scope: !6, file: !1, line: 3, type: !10)
46 !12 = !DILocation(line: 1, column: 1, scope: !6)
47 !13 = !DILocation(line: 2, column: 1, scope: !6)
48 !14 = !DILocation(line: 3, column: 1, scope: !6)
49 !15 = !DILocation(line: 4, column: 1, scope: !6)