Remove debug calls from cloned function

Hey,

within my pass I used CloneFunctionInto to insert a function from an external module into my current module. Replacing IR code with my newly cloned function works fine, only problem is the debug call instruction in my cloned function code (see below):

; Function Attrs: mustprogress noinline nounwind optnone uwtable
define dso_local noundef double @_Z11make_doublei(i32 noundef %0) #2 !dbg !6 {
entry:
  %a.addr = alloca i32, align 4
  store i32 %0, i32* %a.addr, align 4
  call void @llvm.dbg.declare(metadata i32* %a.addr, metadata !12, metadata !DIExpression()), !dbg !13
  %1 = load i32, i32* %a.addr, align 4, !dbg !14
  %conv = sitofp i32 %1 to double, !dbg !14
  %mul = fmul double %conv, 2.000000e+00, !dbg !15
  ret double %mul, !dbg !16
}

Opt crashes with:

While deleting: void (metadata, metadata, metadata)* %llvm.dbg.declare
Use still stuck around after Def is destroyed:  call void @llvm.dbg.declare(metadata i32* %a.addr, metadata !12, metadata !DIExpression()), !dbg !13

If I build the external module IR code without debug flags everything is fine. So how should I handle this debug call?