1 ; RUN: opt -S -passes=licm %s | FileCheck %s
3 ; LICM should null out debug locations when it hoists intrinsics that won't lower to function calls out of a loop.
4 ; CHECK: define float @foo
6 ; CHECK-NEXT: call float @llvm.fma.f32(float %coef_0, float %coef_1, float 0.000000e+00){{$}}
7 ; CHECK-NEXT: br label %loop.header
9 define float @foo(float* %A, float %coef_0, float %coef_1, i32 %n) !dbg !2 {
14 %i = phi i32 [ 0, %entry ], [ %i.inc, %loop.backedge ]
15 %a = phi float [ 0.000000e+00, %entry ], [ %a.inc, %loop.backedge ]
16 %cond = icmp ult i32 %i, %n
17 br i1 %cond, label %loop.backedge, label %exit
20 %i.cast = zext i32 %i to i64
21 %A.ptr = getelementptr inbounds float, float* %A, i64 %i.cast
22 %A.load = load float, float* %A.ptr
23 %fma = call float @llvm.fma.f32(float %coef_0, float %coef_1, float 0.000000e+00), !dbg !3
24 %mul = fmul float %fma, %A.load
25 %a.inc = fadd float %mul, %a
26 %i.inc = add i32 %i, 1
33 declare float @llvm.fma.f32(float, float, float) #1
35 attributes #0 = { nofree nosync nounwind readnone speculatable willreturn }
38 !llvm.module.flags = !{!6}
40 !0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 14", isOptimized: false, runtimeVersion: 0, emissionKind: LineTablesOnly, splitDebugInlining: false, nameTableKind: None)
41 !1 = !DIFile(filename: "source.c", directory: "/")
42 !2 = distinct !DISubprogram(name: "foo", scope: !1, file: !1, line: 1, type: !4, scopeLine: 1, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !5)
43 !3 = !DILocation(line: 4, column: 17, scope: !2)
44 !4 = !DISubroutineType(types: !5)
46 !6 = !{i32 2, !"Debug Info Version", i32 3}