• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2; dbg.value instrinsics should not affect peephole combining of stacksave/stackrestore.
3; PR37713
4; RUN: opt -instcombine %s -S | FileCheck %s
5
6declare i8* @llvm.stacksave() #0
7declare void @llvm.stackrestore(i8*) #0
8
9define i32* @test1(i32 %P) !dbg !6 {
10; CHECK-LABEL: @test1(
11; CHECK-NEXT:    [[TMP1:%.*]] = zext i32 [[P:%.*]] to i64, !dbg !12
12; CHECK-NEXT:    [[A:%.*]] = alloca i32, i64 [[TMP1]], align 4, !dbg !12
13; CHECK-NEXT:    call void @llvm.dbg.value(metadata i32* [[A]], metadata !11, metadata !DIExpression()), !dbg !12
14; CHECK-NEXT:    ret i32* [[A]], !dbg !13
15;
16  %tmp = call i8* @llvm.stacksave(), !dbg !12
17  call void @llvm.dbg.value(metadata i8* %tmp, metadata !9, metadata !DIExpression()), !dbg !12
18  call void @llvm.stackrestore(i8* %tmp), !dbg !13
19  %A = alloca i32, i32 %P, !dbg !14
20  call void @llvm.dbg.value(metadata i32* %A, metadata !11, metadata !DIExpression()), !dbg !14
21  ret i32* %A, !dbg !15
22}
23
24declare void @llvm.dbg.value(metadata, metadata, metadata) #1
25attributes #0 = { nounwind }
26attributes #1 = { nounwind readnone speculatable }
27
28!llvm.dbg.cu = !{!0}
29!llvm.debugify = !{!3, !4}
30!llvm.module.flags = !{!5}
31
32!0 = distinct !DICompileUnit(language: DW_LANG_C, file: !1, producer: "debugify", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2)
33!1 = !DIFile(filename: "patatino.ll", directory: "/")
34!2 = !{}
35!3 = !{i32 4}
36!4 = !{i32 2}
37!5 = !{i32 2, !"Debug Info Version", i32 3}
38!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)
39!7 = !DISubroutineType(types: !2)
40!8 = !{!9, !11}
41!9 = !DILocalVariable(name: "1", scope: !6, file: !1, line: 1, type: !10)
42!10 = !DIBasicType(name: "ty64", size: 64, encoding: DW_ATE_unsigned)
43!11 = !DILocalVariable(name: "2", scope: !6, file: !1, line: 3, type: !10)
44!12 = !DILocation(line: 1, column: 1, scope: !6)
45!13 = !DILocation(line: 2, column: 1, scope: !6)
46!14 = !DILocation(line: 3, column: 1, scope: !6)
47!15 = !DILocation(line: 4, column: 1, scope: !6)
48