84 lines · plain
1; RUN: opt -S -passes=gvn-hoist < %s | FileCheck %s2 3; Hoisted inlinable calls need to have accurate scope information, but we're4; allowed to erase the line information.5 6source_filename = "t.c"7target datalayout = "e-m:w-i64:64-f80:128-n8:16:32:64-S128"8target triple = "x86_64-pc-windows-msvc19.0.24215"9 10; Function Attrs: noinline nounwind readnone uwtable11define float @fabsf(float %f) #0 !dbg !7 {12entry:13 %conv = fpext float %f to double, !dbg !914 %call = call double @fabs(double %conv) #1, !dbg !1015 %conv1 = fptrunc double %call to float, !dbg !1116 ret float %conv1, !dbg !1217}18 19; Function Attrs: nounwind readnone20declare double @fabs(double) #121 22; Function Attrs: noinline nounwind uwtable23define void @hoistit(i32 %cond, float %f) #2 !dbg !13 {24entry:25 %tobool = icmp ne i32 %cond, 0, !dbg !1426 br i1 %tobool, label %if.then, label %if.else, !dbg !1427 28if.then: ; preds = %entry29 %call = call float @fabsf(float %f) #1, !dbg !1530 call void @useit1(float %call), !dbg !1631 br label %if.end, !dbg !1832 33if.else: ; preds = %entry34 %call1 = call float @fabsf(float %f) #1, !dbg !1935 call void @useit2(float %call1), !dbg !2036 br label %if.end37 38if.end: ; preds = %if.else, %if.then39 ret void, !dbg !2140}41 42; CHECK-LABEL: define void @hoistit43; CHECK-SAME: !dbg ![[sp_hoistit:[0-9]+]]44; CHECK: call float @fabsf(float %f) {{.*}} !dbg ![[dbgloc:[0-9]+]]45; CHECK: br i1 %tobool, label %if.then, label %if.else46 47; CHECK: ![[sp_hoistit]] = distinct !DISubprogram(name: "hoistit", {{.*}})48; CHECK: ![[dbgloc]] = !DILocation({{.*}}, scope: ![[sp_hoistit]])49 50declare void @useit1(float)51 52declare void @useit2(float)53 54attributes #0 = { noinline nounwind readnone uwtable }55attributes #1 = { nounwind readnone willreturn }56attributes #2 = { noinline nounwind uwtable }57 58!llvm.dbg.cu = !{!0}59!llvm.module.flags = !{!3, !4, !5}60!llvm.ident = !{!6}61 62!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 5.0.0 ", isOptimized: false, runtimeVersion: 0, emissionKind: LineTablesOnly, enums: !2)63!1 = !DIFile(filename: "t.c", directory: "C:\5Csrc\5Cllvm\5Cbuild")64!2 = !{}65!3 = !{i32 2, !"Dwarf Version", i32 4}66!4 = !{i32 2, !"Debug Info Version", i32 3}67!5 = !{i32 1, !"PIC Level", i32 2}68!6 = !{!"clang version 5.0.0 "}69!7 = distinct !DISubprogram(name: "fabsf", scope: !1, file: !1, line: 4, type: !8, isLocal: false, isDefinition: true, scopeLine: 4, flags: DIFlagPrototyped, isOptimized: false, unit: !0, retainedNodes: !2)70!8 = !DISubroutineType(types: !2)71!9 = !DILocation(line: 5, column: 22, scope: !7)72!10 = !DILocation(line: 5, column: 17, scope: !7)73!11 = !DILocation(line: 5, column: 10, scope: !7)74!12 = !DILocation(line: 5, column: 3, scope: !7)75!13 = distinct !DISubprogram(name: "hoistit", scope: !1, file: !1, line: 7, type: !8, isLocal: false, isDefinition: true, scopeLine: 7, flags: DIFlagPrototyped, isOptimized: false, unit: !0, retainedNodes: !2)76!14 = !DILocation(line: 8, column: 7, scope: !13)77!15 = !DILocation(line: 9, column: 12, scope: !13)78!16 = !DILocation(line: 9, column: 5, scope: !17)79!17 = !DILexicalBlockFile(scope: !13, file: !1, discriminator: 1)80!18 = !DILocation(line: 10, column: 3, scope: !13)81!19 = !DILocation(line: 11, column: 12, scope: !13)82!20 = !DILocation(line: 11, column: 5, scope: !17)83!21 = !DILocation(line: 13, column: 1, scope: !13)84