xref: /llvm-project/llvm/test/DebugInfo/X86/instcombine-demanded-bits-salvage.ll (revision 094572701dce4aaf36f4521d6cf750420d39f206)
1; RUN: opt -mtriple=x86_64-- %s -S -passes=instcombine  -o - | FileCheck %s
2; Verify that demanded bits optimisations don't affect debuginfo
3; variable values.
4; Bugzilla #44371
5
6@a = common dso_local local_unnamed_addr global i32 0, align 4
7
8define dso_local i32 @p() local_unnamed_addr !dbg !11 {
9entry:
10  %conv = load i32, ptr @a, align 4, !dbg !14
11  %0 = and i32 %conv, 65535, !dbg !14
12  ; CHECK: !DIExpression(DW_OP_constu, 65535, DW_OP_and, DW_OP_stack_value),
13  call void @llvm.dbg.value(metadata i32 %0, metadata !15, metadata !DIExpression()), !dbg !14
14  %1 = lshr i32 %0, 12, !dbg !14
15  %2 = and i32 %1, 8, !dbg !14
16  %3 = xor i32 %2, 8, !dbg !14
17  ret i32 0, !dbg !14
18}
19
20declare void @llvm.dbg.value(metadata, metadata, metadata)
21
22!llvm.dbg.cu = !{!0}
23!llvm.module.flags = !{!8, !9}
24!llvm.ident = !{!10}
25
26!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, retainedTypes: !3, globals: !2, splitDebugInlining: false, nameTableKind: None)
27!1 = !DIFile(filename: "instcomnine.ll", directory: "/temp/bz44371")
28!2 = !{}
29!3 = !{!7}
30!7 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
31!8 = !{i32 7, !"Dwarf Version", i32 4}
32!9 = !{i32 2, !"Debug Info Version", i32 3}
33!10 = !{!""}
34!11 = distinct !DISubprogram(name: "p", scope: !1, file: !1, line: 6, type: !12, scopeLine: 6, flags: DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0)
35!12 = !DISubroutineType(types: !13)
36!13 = !{!7}
37!14 = !DILocation(line: 4, column: 35, scope: !11)
38!15 = !DILocalVariable(name: "p_28", arg: 1, scope: !11, file: !1, line: 16, type: !7)
39