xref: /llvm-project/llvm/test/CodeGen/X86/fold-zext-trunc.ll (revision 10b03e66629aedad79a804e22d23b575077303b3)
1; RUN: llc < %s | FileCheck %s -check-prefix=ASM
2; RUN: llc < %s -O0 -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -stop-after livedebugvalues -o - | FileCheck %s -check-prefix=MIR
3
4; RUN: llc --try-experimental-debuginfo-iterators < %s | FileCheck %s -check-prefix=ASM
5; RUN: llc --try-experimental-debuginfo-iterators < %s -O0 -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -stop-after livedebugvalues -o - | FileCheck %s -check-prefix=MIR
6
7; PR9055
8target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:32:32-n8:16:32"
9target triple = "i686-pc-linux-gnu"
10
11%struct.S0 = type { i32, [2 x i8], [2 x i8], [4 x i8] }
12
13@g_98 = common global %struct.S0 zeroinitializer, align 4
14
15define void @foo() nounwind !dbg !5 {
16; ASM: movzbl
17; ASM-NOT: movzbl
18; ASM: calll
19entry:
20  %tmp17 = load i8, ptr getelementptr inbounds (%struct.S0, ptr @g_98, i32 0, i32 1, i32 0), align 4, !dbg !14
21  %tmp54 = zext i8 %tmp17 to i32, !dbg !15
22  %foo = load i32, ptr getelementptr inbounds (%struct.S0, ptr @g_98, i32 0, i32 1, i32 0), align 4, !dbg !16
23; MIR: renamable $edi = MOVZX32rr8 renamable $al, debug-location !16
24  %conv.i = trunc i32 %foo to i8, !dbg !17
25
26  tail call void @func_12(i32 %tmp54, i8 zeroext %conv.i) #0, !dbg !18
27  call void @llvm.dbg.value(metadata i8 %tmp17, metadata !8, metadata !DIExpression()), !dbg !14
28  call void @llvm.dbg.value(metadata i32 %tmp54, metadata !10, metadata !DIExpression()), !dbg !15
29  call void @llvm.dbg.value(metadata i32 %foo, metadata !12, metadata !DIExpression()), !dbg !16
30  call void @llvm.dbg.value(metadata i8 %conv.i, metadata !13, metadata !DIExpression()), !dbg !17
31  ret void, !dbg !19
32}
33
34declare void @func_12(i32, i8 zeroext)
35
36declare void @llvm.dbg.value(metadata, metadata, metadata)
37
38!llvm.dbg.cu = !{!0}
39!llvm.debugify = !{!3, !4}
40
41!0 = distinct !DICompileUnit(language: DW_LANG_C, file: !1, producer: "debugify", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2)
42!1 = !DIFile(filename: "/Users/vsk/src/llvm.org-main/llvm/test/CodeGen/X86/fold-zext-trunc.ll", directory: "/")
43!2 = !{}
44!3 = !{i32 6}
45!4 = !{i32 4}
46!5 = distinct !DISubprogram(name: "foo", linkageName: "foo", scope: null, file: !1, line: 1, type: !6, isLocal: false, isDefinition: true, scopeLine: 1, isOptimized: true, unit: !0, retainedNodes: !7)
47!6 = !DISubroutineType(types: !2)
48!7 = !{!8, !10, !12, !13}
49!8 = !DILocalVariable(name: "1", scope: !5, file: !1, line: 1, type: !9)
50!9 = !DIBasicType(name: "ty8", size: 8, encoding: DW_ATE_unsigned)
51!10 = !DILocalVariable(name: "2", scope: !5, file: !1, line: 2, type: !11)
52!11 = !DIBasicType(name: "ty32", size: 32, encoding: DW_ATE_unsigned)
53!12 = !DILocalVariable(name: "3", scope: !5, file: !1, line: 3, type: !11)
54!13 = !DILocalVariable(name: "4", scope: !5, file: !1, line: 4, type: !9)
55!14 = !DILocation(line: 1, column: 1, scope: !5)
56!15 = !DILocation(line: 2, column: 1, scope: !5)
57!16 = !DILocation(line: 3, column: 1, scope: !5)
58!17 = !DILocation(line: 4, column: 1, scope: !5)
59!18 = !DILocation(line: 5, column: 1, scope: !5)
60!19 = !DILocation(line: 6, column: 1, scope: !5)
61!20 = !{i32 2, !"Debug Info Version", i32 3}
62!llvm.module.flags = !{!20}
63