1 ; RUN: opt -S %s -early-cse | FileCheck %s
3 target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
5 @a = global i8 25, align 1, !dbg !0
7 define signext i16 @b() !dbg !12 {
9 call void @llvm.dbg.value(metadata i16 23680, metadata !17, metadata !DIExpression()), !dbg !18
10 %0 = load i8, i8* @a, align 1, !dbg !19, !tbaa !20
11 %conv = sext i8 %0 to i16, !dbg !19
13 ; CHECK: call void @llvm.dbg.value(metadata i16 undef, metadata !17, metadata !DIExpression()), !dbg !18
14 ; CHECK-NEXT: call i32 (...) @optimize_me_not()
16 call void @llvm.dbg.value(metadata i16 %conv, metadata !17, metadata !DIExpression()), !dbg !18
17 %call = call i32 (...) @optimize_me_not(), !dbg !23
18 %1 = load i8, i8* @a, align 1, !dbg !24, !tbaa !20
19 %conv1 = sext i8 %1 to i16, !dbg !24
20 ret i16 %conv1, !dbg !25
23 declare void @llvm.dbg.declare(metadata, metadata, metadata)
24 declare i32 @optimize_me_not(...)
26 define i32 @main() !dbg !26 {
28 %call = call signext i16 @b(), !dbg !30
32 declare void @llvm.dbg.value(metadata, metadata, metadata)
35 !llvm.module.flags = !{!7, !8, !9, !10}
38 !0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression())
39 !1 = distinct !DIGlobalVariable(name: "a", scope: !2, file: !3, line: 1, type: !6, isLocal: false, isDefinition: true)
40 !2 = distinct !DICompileUnit(language: DW_LANG_C99, file: !3, producer: "clang version 8.0.0 ", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !4, globals: !5, nameTableKind: GNU)
41 !3 = !DIFile(filename: "patatino.c", directory: "/Users/davide/llvm-monorepo/llvm-mono/build/bin")
44 !6 = !DIBasicType(name: "char", size: 8, encoding: DW_ATE_signed_char)
45 !7 = !{i32 2, !"Dwarf Version", i32 4}
46 !8 = !{i32 2, !"Debug Info Version", i32 3}
47 !9 = !{i32 1, !"wchar_size", i32 4}
48 !10 = !{i32 7, !"PIC Level", i32 2}
49 !11 = !{!"clang version 8.0.0 "}
50 !12 = distinct !DISubprogram(name: "b", scope: !3, file: !3, line: 2, type: !13, scopeLine: 2, flags: DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !2, retainedNodes: !16)
51 !13 = !DISubroutineType(types: !14)
53 !15 = !DIBasicType(name: "short", size: 16, encoding: DW_ATE_signed)
55 !17 = !DILocalVariable(name: "i", scope: !12, file: !3, line: 3, type: !15)
56 !18 = !DILocation(line: 3, column: 9, scope: !12)
57 !19 = !DILocation(line: 4, column: 7, scope: !12)
58 !20 = !{!21, !21, i64 0}
59 !21 = !{!"omnipotent char", !22, i64 0}
60 !22 = !{!"Simple C/C++ TBAA"}
61 !23 = !DILocation(line: 5, column: 3, scope: !12)
62 !24 = !DILocation(line: 6, column: 10, scope: !12)
63 !25 = !DILocation(line: 6, column: 3, scope: !12)
64 !26 = distinct !DISubprogram(name: "main", scope: !3, file: !3, line: 8, type: !27, scopeLine: 8, flags: DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !2, retainedNodes: !4)
65 !27 = !DISubroutineType(types: !28)
67 !29 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
68 !30 = !DILocation(line: 8, column: 14, scope: !26)
69 !31 = !DILocation(line: 8, column: 19, scope: !26)